Expand description
Mark-sweep garbage collection for blobs (ADR 0012, gonzalo#292).
A blob is live iff some stored record still points at it: as a record’s
own Body::Blob, as the blob a tombstone pins, as a slice a graph
manifest names, or as a shard a vector manifest names. GC marks that union
and sweeps every stored blob outside it. Liveness is derived from the
records themselves rather than a maintained refcount, so it is
self-correcting: a missed event can leave a blob briefly un-swept, never
wrongly deleted, and never leaked forever the way a drifted refcount would.
Structs§
- GcReport
- What a GC sweep did.
- Sweep
Policy - When a sweep runs and how old a blob must be to qualify.
Constants§
- DEFAULT_
MIN_ AGE - How long a blob must have gone untouched before a sweep may delete it.
Functions§
- gc_
blobs - Mark-sweep every blob in
store: delete the ones no record references. - gc_
blobs_ with - As
gc_blobs, with an explicit policy. - live_
blob_ hashes - The mark set: every blob hash these records still need.
recordsmust be the store’s raw records, tombstones included. - sweep_
blobs - Delete every blob in
blobsoutside thelivemark set and at leastDEFAULT_MIN_AGEold, and report what was freed, retained, and deferred. - sweep_
blobs_ with - As
sweep_blobs, with an explicit policy.