Expand description
Garbage collection for Shardline chunk storage.
This crate provides local filesystem garbage collection including orphan chunk discovery, quarantine lifecycle management, and retention window enforcement.
§Quick start
GC is driven by a LocalGcOptions mode selection and reports back through
LocalGcReport. The options and report types are pure and safe to build
directly:
use shardline_gc::{
LocalGcDiagnostics, LocalGcOptions, LocalGcReport, MINIMUM_GC_RETENTION_SECONDS,
};
// Default options are a no-op dry run: nothing is marked or deleted.
let options = LocalGcOptions::default();
assert_eq!(options.mode_name(), "dry-run");
assert!(!options.mark && !options.sweep);
// A real cleanup run marks orphans and sweeps expired quarantine entries,
// with a retention window that protects in-flight uploads.
let options = LocalGcOptions::mark_and_sweep(MINIMUM_GC_RETENTION_SECONDS);
assert_eq!(options.mode_name(), "mark-and-sweep");
// Reports and diagnostics are plain data you can inspect after a run.
let report = LocalGcReport::default();
assert_eq!(report.deleted_chunks, 0);
let diagnostics = LocalGcDiagnostics {
report,
retention_report: Vec::new(),
orphan_inventory: Vec::new(),
};
assert!(diagnostics.orphan_inventory.is_empty());To run GC against real storage, drive run_gc_with_stores with explicit
record, index, and object-store adapters (the shardline-server crate wires
this up from its own configuration).
Structs§
- GcOrphan
Inventory Entry - One currently orphaned object after a GC run.
- GcRetention
Report Entry - One active retention-window entry after a GC run.
- Local
GcDiagnostics - Detailed GC diagnostics intended for operators and automation.
- Local
GcOptions - Local filesystem garbage-collection execution options.
- Local
GcReport - Local filesystem garbage-collection report.
- Local
Record Store - Re-exported index types for convenience. Local SQLite implementation of the record-store contract.
- Server
Frontend Parse Error - Invalid server frontend token.
Enums§
- GcError
- Garbage collection runtime failure.
- GcOrphan
Quarantine State - Quarantine state for one orphaned object.
- Server
Frontend - Runtime protocol frontend selection.
- Server
Frontend Kind - Runtime protocol frontend selection.
Constants§
- DEFAULT_
LOCAL_ GC_ RETENTION_ SECONDS - Default retention window for new local quarantine candidates. Default retention window for new local quarantine candidates.
- MINIMUM_
GC_ RETENTION_ SECONDS - Minimum retention window in seconds for GC quarantine entries.
Functions§
- quarantine_
record_ path - Returns the quarantine record path for the given hash.
- quarantine_
root - Returns the quarantine root directory for the given storage root.
- run_
gc_ with_ oci_ tombstones - Runs GC with OCI tombstone reclamation enabled.
- run_
gc_ with_ stores - Runs garbage collection against provided record, index, and object stores.
- run_
local_ gc - Runs local filesystem garbage collection.
- run_
local_ gc_ diagnostics - Runs local filesystem garbage collection and returns operator diagnostics.
- run_
postgres_ gc_ with_ remote_ delete_ protection - Runs Postgres GC with durable admission around S3 object deletes.