version

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 10 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
}

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
	// 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