Expand description
Background pruning of expired + terminal backup bundles.
Two passes on each invocation:
-
TTL pass — for every non-terminal bundle whose
expires_athas passed, delete its blob file (if any) and transition the record toExpired. The expired record persists for the retention window so audit tools and the operator-facing CLI can still see what happened. -
Retention pass — for every terminal bundle (Aborted, Expired, ExportAcked, ImportCommitted, ExportDownloaded) older than the retention cutoff, remove the record entirely. Default retention is 24h from
created_at— long enough for operator audit follow-up, short enough that records don’t accumulate.
Called from the storage thread’s interval loop in
server::run(). Failures log at warn! but don’t abort the
loop — a transient fjall or filesystem error shouldn’t take
down the storage thread.
Structs§
- Sweep
Stats - Sweeper result counters. Returned for the storage thread’s log line and consumed by tests asserting the right work happened.
Constants§
- RETENTION_
DURATION_ HOURS - How long a terminal bundle’s record sticks around before the retention pass deletes it. Long enough for operator audit follow-up, short enough to keep the keyspace tidy.
Functions§
- is_
terminal is_terminalalready lives onBundleStatebut we re-export the predicate signature here aspubindirection so future callers can writebackup_bundle_sweeper::is_terminal(state)without reaching into the store module’s surface. Currently referenced only by the sweeper itself + tests.- sweep_
bundles - Run one sweep pass over the backup-bundle keyspace.