cache

package
v0.2.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChartEntryPath

func ChartEntryPath(root, kind, key string) string

func ChartKindRoot

func ChartKindRoot(root, kind string) string

func GitEntryPath

func GitEntryPath(root, key string) string

func MetadataPath

func MetadataPath(entryPath string) string

func OCIEntryPath added in v0.2.7

func OCIEntryPath(root, key string) string

func RedactedTarget

func RedactedTarget(raw string) string

func RemoteEntryPath

func RemoteEntryPath(root, key string) string

func RemoteGitRepoPath

func RemoteGitRepoPath(root, key string) string

func RemoteHTTPFilePath

func RemoteHTTPFilePath(root, key string) string

func WriteMetadata

func WriteMetadata(entryPath string, metadata Metadata) error

Types

type Entry

type Entry struct {
	Source       Source    `json:"source" yaml:"source"`
	Kind         string    `json:"kind" yaml:"kind"`
	Key          string    `json:"key" yaml:"key"`
	Path         string    `json:"path" yaml:"path"`
	MetadataPath string    `json:"metadataPath,omitempty" yaml:"metadataPath,omitempty"`
	SizeBytes    int64     `json:"sizeBytes" yaml:"sizeBytes"`
	ModifiedAt   time.Time `json:"modifiedAt" yaml:"modifiedAt"`
	Legacy       bool      `json:"legacy" yaml:"legacy"`
	Metadata     *Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	// PruneReason is set to "age" or "size" only on entries selected for removal
	// by Prune(). Zero value is omitted from JSON/YAML output so that cache list
	// output remains byte-identical to pre-prune output.
	PruneReason string `json:"pruneReason,omitempty" yaml:"pruneReason,omitempty"`
	// contains filtered or unexported fields
}

func List

func List(opts Options) ([]Entry, error)

type Metadata

type Metadata struct {
	SchemaVersion int       `json:"schemaVersion" yaml:"schemaVersion"`
	Source        Source    `json:"source" yaml:"source"`
	Kind          string    `json:"kind" yaml:"kind"`
	Key           string    `json:"key" yaml:"key"`
	Target        string    `json:"target,omitempty" yaml:"target,omitempty"`
	Name          string    `json:"name,omitempty" yaml:"name,omitempty"`
	Version       string    `json:"version,omitempty" yaml:"version,omitempty"`
	Revision      string    `json:"revision,omitempty" yaml:"revision,omitempty"`
	Path          string    `json:"path,omitempty" yaml:"path,omitempty"`
	CreatedAt     time.Time `json:"createdAt" yaml:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt" yaml:"updatedAt"`
}

func ReadMetadata

func ReadMetadata(entryPath string, expected Source, expectedKind, expectedKey string) (*Metadata, error)

type OperationOptions

type OperationOptions struct {
	Options
	OlderThan           time.Duration
	DryRun              bool
	Yes                 bool
	Source              Source
	Kind                string
	Key                 string
	All                 bool
	RenderCacheMaxBytes int64
	// MaxBytes caps the summed SizeBytes of the entries selected by the source/kind
	// filters. Evicts least-recently-used (oldest entryAgeTime) entries until the
	// total is at or below this cap. 0 disables the size phase. Named to parallel
	// RenderCacheMaxBytes.
	MaxBytes int64
}

type OperationResult

type OperationResult struct {
	Entries      []Entry                  `json:"entries" yaml:"entries"`
	RemovedCount int                      `json:"removedCount" yaml:"removedCount"`
	DryRun       bool                     `json:"dryRun" yaml:"dryRun"`
	RenderSweep  *rendercache.SweepResult `json:"renderSweep,omitempty" yaml:"renderSweep,omitempty"`
	// SizeEvictedBytes is the sum of SizeBytes for all entries removed by the size
	// phase. Populated on both dry-run and real runs. Always present in JSON/YAML
	// output (not omitempty) for a consistent numeric summary.
	SizeEvictedBytes int64 `json:"sizeEvictedBytes" yaml:"sizeEvictedBytes"`
	// TotalSizeBytes is the selected-set total after both age and size phases,
	// BEFORE the render sweep. The sweep (which runs after removals on real runs,
	// never on dry-run) can trim renders further; its effect is reported separately
	// in RenderSweep. Always present in JSON/YAML output (not omitempty).
	TotalSizeBytes int64 `json:"totalSizeBytes" yaml:"totalSizeBytes"`
}

func Delete

func Delete(opts OperationOptions) (OperationResult, error)

func Prune

func Prune(opts OperationOptions) (OperationResult, error)

type Options

type Options struct {
	GitCacheDir    string
	ChartCacheDir  string
	RemoteCacheDir string
	RenderCacheDir string
	OCICacheDir    string
	Sources        []Source
	ForbiddenRoots []string
}

type Source

type Source string
const (
	SourceGit    Source = "git"
	SourceChart  Source = "chart"
	SourceRemote Source = "remote"
	SourceRender Source = "render"
	// SourceOCI is the first-class OCI artifact image cache. The name does not
	// collide with the chart cache's "oci" repository kind: Source and Kind are
	// distinct fields on entries and metadata, and chart "oci" only appears as
	// a Kind under SourceChart (listChartEntries below).
	SourceOCI Source = "oci"
)

Jump to

Keyboard shortcuts

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