Documentation
¶
Overview ¶
Package diskgc is the disk-pressure auto-reclaim loop. When host disk usage crosses a threshold it reclaims DANGLING docker images + build cache — the superseded builds that pile up as apps redeploy and are the usual reason a box fills up — and alerts the operator.
It only ever removes GARBAGE: `docker image prune -f` never touches a tagged image or one used by a container (running or stopped), and a Mooring rollback rebuilds its image, so this can't break a rollback or delete app data. It rides the one-docker-child semaphore via TryAcquire (skip-don't-queue), so it never delays a deploy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pruner ¶
type Pruner interface {
PruneImagesHeld(ctx context.Context, onLine func(string)) error
PruneBuildCacheHeld(ctx context.Context, keep string, onLine func(string)) error
}
Pruner runs the reclaim commands under a semaphore the CALLER already holds (satisfied by dockerexec.Runner). Both methods are the *Held variants: diskgc.Check holds the one docker slot across both prunes, so a non-Held call that re-Acquires the same slot would deadlock.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is the disk-pressure watcher.
func New ¶
func New(sample Sampler, prune Pruner, sem Sem, thresholdPct int, interval time.Duration, keep string, buildCacheGC bool, alert func(level, title, detail string), log *slog.Logger) *Runner
New builds a Runner. alert may be nil. buildCacheGC=false skips the build-cache prune (honors the operator's build_cache_keep_enabled:false opt-out); the dangling-image prune always runs.