version

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package version implements retention garbage collection for AppVersions.

Every deploy mints a new AppVersion that otherwise lives forever, bloating the entity store and making the ephemeral GC's full-version scan grow without bound. This controller hard-deletes old non-active, non-ephemeral versions so that growth stays bounded. Ephemeral versions are skipped — they have their own TTL-based GC (controllers/ephemeral).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCConfig

type GCConfig struct {
	// CheckInterval is how often to run the GC sweep (default: 1h).
	CheckInterval time.Duration
	// RetentionPeriod keeps versions newer than this regardless of count
	// (default: 30 days).
	RetentionPeriod time.Duration
	// RetentionCount keeps this many most-recent versions per app regardless of
	// age (default: 10).
	RetentionCount int
	// DiskPressureThreshold is the storage-usage percentage at or above which a
	// sweep drops the RetentionPeriod floor and prunes each app down to its
	// active version plus RetentionCount most-recent versions. Without this, the
	// period floor pins every version younger than RetentionPeriod, so on a
	// busy cluster the downstream image GC has nothing to reclaim and the disk
	// fills. The active version and RetentionCount are always honored, even
	// under pressure. Matches the image GC's threshold (default: 80). Zero
	// disables pressure-aware pruning.
	DiskPressureThreshold float64
}

GCConfig holds configuration for app version retention GC.

func DefaultGCConfig

func DefaultGCConfig() GCConfig

DefaultGCConfig returns the default GC configuration.

type GCController

type GCController struct {
	Log    *slog.Logger
	EAC    *entityserver_v1alpha.EntityAccessClient
	Config GCConfig

	// DataPath is the server data directory sampled for disk usage when
	// DiskPressureThreshold is set. Empty disables pressure-aware pruning.
	DataPath string
	// contains filtered or unexported fields
}

GCController periodically applies retention policy to AppVersions, hard-deleting old non-active, non-ephemeral versions.

func (*GCController) RunGC

func (c *GCController) RunGC(ctx context.Context) (*GCResult, error)

RunGC applies the retention policy to all non-ephemeral AppVersions.

func (*GCController) Start

func (c *GCController) Start(ctx context.Context)

Start begins the periodic GC process.

func (*GCController) Stop

func (c *GCController) Stop()

Stop gracefully stops the controller.

type GCResult

type GCResult struct {
	// DeletedVersions is the number of versions hard-deleted.
	DeletedVersions int
	// FailedVersions is the number of versions that failed to delete.
	FailedVersions int
	// RetainedVersions is the number of versions kept by retention policy.
	RetainedVersions int
	// SkippedLive is the number of prune candidates retained because a live
	// sandbox still references them.
	SkippedLive int
	// TotalScanned is the number of non-ephemeral versions evaluated.
	TotalScanned int
}

GCResult contains information about versions processed during a GC sweep.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL