Skip to main content

Module state

Module state 

Source
Expand description

Machine-local forge state on the redb account_usage table: the per-account usage cache, one row per account. Values are serde-json; no field schema on disk.

Re-exportsΒ§

use std::collections::BTreeMap; πŸ”’
use anyhow::Context; πŸ”’
use redb::ReadableTable; πŸ”’
use redb::TableDefinition; πŸ”’
use super::Db; πŸ”’
use crate::account_cache::CachedAccountUsage; πŸ”’

ConstantsΒ§

ACCOUNT_USAGE πŸ”’

FunctionsΒ§

account_usage
Every cached per-account usage snapshot, keyed by account display name. A record that fails to decode is skipped with a warn so one corrupt blob can’t wipe the rest of the cache.
replace_account_usage
Overwrite the usage cache with entries: clear every row then insert the full map in one write txn, mirroring the poller’s whole-map write.