Skip to main content

Module gc

Module gc 

Source
Expand description

Mark-sweep garbage collection for content-addressed slices (ADR 0012).

A slice blob is live iff some live manifest references its hash. GC marks the union of every live manifest’s hashes, then sweeps any stored blob outside that set. Liveness is derived from the manifests themselves rather than a maintained refcount, so it is self-correcting: a missed event can leave a slice briefly un-swept, never wrongly deleted, and never leaked forever the way a drifted refcount would.

Structs§

GcReport
What a GC sweep did.

Functions§

gc_blobs
Sweep blobs: delete every stored slice no live_manifests entry references, and report what was freed vs. retained. Mark-sweep — see the module docs for why this is preferred over refcounting.
live_slice_hashes
The mark set: every slice hash referenced by any of the manifests.
unreferenced_slices
The sweep set: hashes present in all but referenced by no live manifest, returned sorted (all - live).