Phase 9: two-phase garbage collection engine
GC engine (internal/gc/): Collector.Run() implements the two-phase algorithm — Phase 1 finds unreferenced blobs and deletes DB rows in a single transaction, Phase 2 deletes blob files from storage. Registry-wide mutex blocks concurrent GC runs. Collector.Reconcile() scans filesystem for orphaned files with no DB row (crash recovery). Wired into admin_gc.go: POST /v1/gc now launches the real collector in a goroutine with gc_started/gc_completed audit events. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
6
internal/gc/errors.go
Normal file
6
internal/gc/errors.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package gc
|
||||
|
||||
import "errors"
|
||||
|
||||
// ErrGCRunning indicates that a GC run is already in progress.
|
||||
var ErrGCRunning = errors.New("gc: already running")
|
||||
Reference in New Issue
Block a user