Expand description
Samples every governed pool’s live usage into the shared accounting (ADR 0073 §2). Live usage reporting into the shared accounting pool — ADR 0073 §2.
Every governed pool already owns a counter for its own footprint: the page
cache knows its resident slot count, the blob cache its bytes_in_use, the
segments their resident estimates and retained lifetimes, the WAL queue its
buffered bytes.
This module is the seam that reads those counters and stores them into the
one shared pool, so red.stats can show per-pool share_bytes /
used_bytes against a single total.
Pull, not push. The alternative — every subsystem holding an
Arc<MemoryAccounting> and updating it inline — would thread the pool into
the page-cache hit path and the segment insert path, which is exactly the
per-operation cost ADR 0073 §3 forbids. Instead the pools keep the atomics
they already maintain and a reader samples them. A refresh is a handful of
resident-counter reads under the segment publication locks; ordinary read
hot paths gain no accounting hook.
This sampler reports usage. memory_admission applies the growth checks
against the shared budget (ADR 0073 §4).