pub struct PackCache { /* private fields */ }Expand description
The request-digest pack cache of the through-store shape: repeat
fetches of the same (canonicalized) want/have set ride the stored
pack without regeneration. Evictions (capacity bounded) and
releases (PackCache::release_all) drop the entry’s pins — the
sweep reclaims the pack blobs the next time it runs (substrate.md
§object storage: “releases/evictions are pins the next sweep
reclaims”).
Implementations§
Source§impl PackCache
impl PackCache
Sourcepub fn new(max_entries: usize) -> Self
pub fn new(max_entries: usize) -> Self
The cache holding at most max_entries generated packs (a 0
clamps to 1 — a zero-capacity cache would evict on every insert
but must not loop). The store handle stays with the
PackGen front; the cache is the digest-to-pack mapping.
Sourcepub fn release_all(&self) -> usize
pub fn release_all(&self) -> usize
The cache’s release path — the PackHousekeeping consumer’s
action: drop every cached entry (their pins release) and return
the released count. The released packs are reclaimed by the next
sweep.