Expand description
Per-file usage-summary cache on the redb token_usage table.
Keyed by canonical session-file path; the value is that fileโs
deduped FileUsageSummary. The cache is incremental: the scan
reuses a file whose mtime and size still match the cached entry
rather than re-parsing a transcript that can reach 100 MB.
Re-exportsยง
use anyhow::Context;๐use forge_agent::env::token_usage::FileUsageSummary;๐use redb::TableDefinition;๐use super::Db;๐
Constantsยง
- TOKEN_
USAGE ๐
Functionsยง
- decode ๐
- Decode a stored blob, tagging a failure with the owning path.
- load
- The cached summary for
path, orNonewhen absent (or the table doesnโt exist yet). A decode failure is surfaced so a corrupt row is diagnosable rather than silently treated as a cache miss. - store
- Store
summaryforpath, overwriting any prior entry.