Documentation ¶
Overview ¶
Adapted from https://github.com/thought-machine/please Copyright Thought Machine, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Package cache abstracts storing and fetching previously run tasks ¶
Adapted from https://github.com/thought-machine/please Copyright Thought Machine, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Package cache implements our cache abstraction.
Adapted from https://github.com/thought-machine/please Copyright Thought Machine, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Adapted from https://github.com/thought-machine/please Copyright Thought Machine, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func AddFlags(opts *Opts, flags *pflag.FlagSet)
- func DefaultLocation(repoRoot titanpath.AbsoluteSystemPath) titanpath.AbsoluteSystemPath
- func WriteCacheMetaFile(path titanpath.AbsoluteSystemPath, config *CacheMetadata) error
- type ArtifactSignatureAuthentication
- type Cache
- type CacheEvent
- type CacheMetadata
- type ItemStatus
- type OnCacheRemoved
- type Opts
- type StreamValidator
Constants ¶
This section is empty.
Variables ¶
var ErrNoCachesEnabled = errors.New("no caches are enabled")
ErrNoCachesEnabled is returned when both the filesystem and http cache are unavailable
Functions ¶
func DefaultLocation ¶
func DefaultLocation(repoRoot titanpath.AbsoluteSystemPath) titanpath.AbsoluteSystemPath
DefaultLocation returns the default filesystem cache location, given a repo root
func WriteCacheMetaFile ¶
func WriteCacheMetaFile(path titanpath.AbsoluteSystemPath, config *CacheMetadata) error
WriteCacheMetaFile writes cache metadata file at a path
Types ¶
type ArtifactSignatureAuthentication ¶
type ArtifactSignatureAuthentication struct {
// contains filtered or unexported fields
}
type Cache ¶
type Cache interface { // Fetch returns true if there is a cache it. It is expected to move files // into their correct position as a side effect Fetch(anchor titanpath.AbsoluteSystemPath, hash string, files []string) (bool, []titanpath.AnchoredSystemPath, int, error) Exists(hash string) (ItemStatus, error) // Put caches files for a given hash Put(anchor titanpath.AbsoluteSystemPath, hash string, duration int, files []titanpath.AnchoredSystemPath) error Clean(anchor titanpath.AbsoluteSystemPath) CleanAll() Shutdown() }
Cache is abstracted way to cache/fetch previously run tasks
func New ¶
func New(opts Opts, repoRoot titanpath.AbsoluteSystemPath, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error)
New creates a new cache
type CacheEvent ¶
type CacheMetadata ¶
CacheMetadata stores duration and hash information for a cache entry so that aggregate Time Saved calculations can be made from artifacts from various caches
func ReadCacheMetaFile ¶
func ReadCacheMetaFile(path titanpath.AbsoluteSystemPath) (*CacheMetadata, error)
ReadCacheMetaFile reads cache metadata file at a path
type ItemStatus ¶
ItemStatus holds whether artifacts exists for a given hash on local and/or remote caching server
type OnCacheRemoved ¶
OnCacheRemoved defines a callback that the cache system calls if a particular cache needs to be removed. In practice, this happens when Remote Caching has been disabled the but CLI continues to try to use it.
type Opts ¶
type Opts struct { OverrideDir string SkipRemote bool SkipFilesystem bool Workers int RemoteCacheOpts fs.RemoteCacheOptions }
Opts holds configuration options for the cache TODO(gsoltis): further refactor this into fs cache opts and http cache opts
type StreamValidator ¶
type StreamValidator struct {
// contains filtered or unexported fields
}
func (*StreamValidator) CurrentValue ¶
func (sv *StreamValidator) CurrentValue() string
func (*StreamValidator) Validate ¶
func (sv *StreamValidator) Validate(expectedTag string) bool