Documentation
¶
Overview ¶
Package cache owns deterministic persistent-cache identity and storage.
Index ¶
Constants ¶
const (
// MaxEntrySize bounds one decoded cache value.
MaxEntrySize = 16 << 20
)
Variables ¶
var ErrConflict = errors.New("cache entry conflicts with an existing value")
ErrConflict reports two valid values for one deterministic cache key.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
Kind ComponentKind
Identity string
Digest Digest
}
Component binds one named input to its exact digest.
type ComponentKind ¶
type ComponentKind string
ComponentKind identifies one result-changing input class.
const ( ComponentSource ComponentKind = "source" ComponentModule ComponentKind = "module" ComponentWorkspace ComponentKind = "workspace" ComponentOverlay ComponentKind = "overlay" ComponentBuildSelection ComponentKind = "build-selection" ComponentEnvironment ComponentKind = "environment" ComponentDependencyExport ComponentKind = "dependency-export" ComponentFact ComponentKind = "fact" )
type Key ¶
Key is one complete cache identity.
type KeyInput ¶
type KeyInput struct {
Namespace string
ToolVersion string
BuildGoVersion string
SourceGoVersion string
Configuration Digest
Rules []RuleInput
BuildTags []string
GOOS string
GOARCH string
CGOEnabled bool
FormatterMode string
Components []Component
}
KeyInput contains every explicit result-changing input selected by a cache consumer for one result namespace. It performs no ambient environment lookup.
type PruneOptions ¶
PruneOptions bounds retained canonical entries and may remove publication temporaries older than an explicit cutoff. A zero size field leaves that dimension unlimited; at least one positive size limit is required.
type PruneResult ¶
type PruneResult struct {
EntriesBefore int
BytesBefore int64
EntriesRemoved int
BytesRemoved int64
CorruptRemoved int
TemporaryRemoved int
EntriesAfter int
BytesAfter int64
}
PruneResult reports one best-effort snapshot of canonical cache entries. Concurrent stores may change the root after it is scanned.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is one rooted, content-verifying persistent cache.
func OpenValidated ¶
OpenValidated resolves a cache root, validates that immutable target, and then opens or creates it without following mutable path components. The validator runs before any directory is created.
func (*Store) Get ¶
Get returns an independently owned verified payload. Missing and corrupt entries are cache misses so callers can recompute them.
func (*Store) Prune ¶
func (s *Store) Prune(ctx context.Context, options PruneOptions) (PruneResult, error)
Prune removes eligible stale publication temporaries and canonical corrupt entries, then evicts the oldest valid entries until both configured limits are satisfied. Publication time is represented by file modification time; equal times are ordered by key.