Expand description
Time-Machine-style retention thinning for Tier-2 version history.
Named versions (those with a label) and the latest version are kept forever;
all other versions are thinned by age into coarser buckets the older they get
(all recent, then hourly, daily, weekly). Thinning rewrites versions.jsonl
and re-links each kept version’s parent to the previous kept version so that
@head~N walks remain valid. Object GC and storage caps are separate passes.
Structs§
- CapReport
- Outcome of an
apply_capspass. - Maintain
Report - Combined outcome of a
maintainpass. - Retention
Policy - Controls the age windows used by
thin_versionsto decide which versions survive thinning. - Thin
Report - Outcome of an
apply_thinningpass.
Functions§
- apply_
caps - Enforce the per-doc count and size caps: drop the OLDEST unnamed, non-latest
versions until at most
max_versionsremain AND the total compressed size of objects referenced by retained versions is at mostmax_object_bytes. Named versions and the latest version are never dropped. Rewritesversions.jsonl(re-linking parents). Orphaned objects are reclaimed by a later gc pass. - apply_
thinning - Apply
policytodoc_id’s versions: drop thinned-out versions and rewriteversions.jsonl, re-linking each kept version’s parent to the previous kept version. - maintain
- Full durable-retention pass for
doc_id: thin by age, enforce caps, then garbage-collect now-unreferenced objects. The single entry point a host calls periodically (e.g. on close or on a timer). - thin_
versions - Return the set of version ids to KEEP under
policygiven the current time.