Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Key ¶
func Key(rc resource.ResourceConfig, scm *SCMIdentity) string
Key computes a cache key from a ResourceConfig and, when bound to an SCM, the resolved SCM identity. Pass scm=nil for sources that run without an SCM; the omitempty tag on cacheKeyInput.SCM keeps the hash identical to the pre-SCM form in that case. Returns empty string when hashing fails; callers treat that as a cache miss.
Types ¶
type SCMIdentity ¶ added in v0.116.3
SCMIdentity is the resolved repo URL and source branch a source reads from. Credentials are excluded: they live in separate Config fields and do not change the fetched content.
type SourceCache ¶
type SourceCache struct {
// contains filtered or unexported fields
}
SourceCache is a thread-safe in-memory cache for source execution results, keyed by SHA256 of the sanitized resource configuration. The cache lives for the duration of one updatecli execution and is shared across all pipelines, allowing identical sources to be executed only once.
NOTE: today pipelines run sequentially and DAG nodes are serialized by a mutex, so concurrent cache misses for the same key cannot happen. If pipeline execution is ever parallelized, consider adding a singleflight.Group to coalesce concurrent lookups for the same key.
func NewSourceCache ¶
func NewSourceCache() *SourceCache
NewSourceCache creates a new empty source cache.
func (*SourceCache) Get ¶
func (c *SourceCache) Get(key string) (SourceEntry, bool)
Get retrieves a cached source entry. Returns the entry and true if found.
func (*SourceCache) Len ¶
func (c *SourceCache) Len() int
Len returns the number of entries currently held in the cache.
func (*SourceCache) Set ¶
func (c *SourceCache) Set(key string, entry SourceEntry)
Set stores a source entry in the cache.
type SourceEntry ¶
type SourceEntry struct {
Information string // Raw value returned by the plugin, before transformers
Description string
Result string // SUCCESS / FAILURE / etc.
}
SourceEntry stores the cached result of a source execution. Transformers are not included — they are re-applied on cache hit so that sources sharing the same underlying resource config but different transformer chains each get the correctly transformed output.