Rust implementation of OCI Distribution Spec with granular access control

Add scheduled automatic garbage collection #8

open opened by pierrelf.com

Problem#

Garbage collection only runs when manually triggered via POST /admin/gc. There is no way to schedule periodic automatic GC, meaning unreferenced blobs accumulate until an admin remembers to trigger cleanup.

Proposed Solution#

  • Add a --gc-interval CLI argument (e.g., --gc-interval 24h)
  • Spawn a background tokio task that runs GC on the configured interval
  • Use the existing gc::run_gc() function with configurable dry-run and grace period
  • Log GC results and expose last-GC metrics (timestamp, blobs freed, bytes freed)
  • Add grain_gc_last_run_timestamp and grain_gc_bytes_freed_total Prometheus gauges/counters
  • Keep the manual POST /admin/gc endpoint for on-demand runs

Files to modify#

  • src/main.rs - Spawn background GC task
  • src/args.rs - Add --gc-interval and --gc-grace-period args
  • src/metrics.rs - Add GC metrics
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mfkg7sygue2x