Documentation
¶
Overview ¶
Package gc provides a generic background sweep worker used by all GC subsystems in xolu: blob storage, timeseries retention, FSM machine collection (v2), and event delivery log cleanup (v2).
The package implements the ticker-and-stop-channel lifecycle pattern once so that each sweeper only needs to implement the Sweeper interface. Workers are registered at server startup and exposed via the admin API at POST /api/v1/admin/gc/{name}/run and GET /api/v1/admin/gc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Report ¶
type Report struct {
Examined int // items inspected this cycle
Collected int // items collected (deleted or hard-purged)
Quarantined int // items moved to a staging area (two-phase sweepers)
Errors int // non-fatal errors encountered
Duration time.Duration // wall time for the sweep
}
Report summarises the result of a single sweep cycle. Zero values are valid; sweepers that do not track a field leave it at 0.
type Sweeper ¶
Sweeper is implemented by each GC subsystem. Sweep must be safe to call concurrently from RunOnce and the ticker goroutine.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker runs a Sweeper on a ticker interval. It is safe for concurrent use.
func (*Worker) LastReport ¶
LastReport returns the report from the most recent completed sweep and the time it started. Returns a zero Report and zero time if no sweep has completed yet.
func (*Worker) RunOnce ¶
RunOnce executes a single sweep synchronously. Used by the admin endpoint and by tests. Safe to call concurrently with the background goroutine.