Documentation ¶
Index ¶
- type Cache
- type InvalidChecksumError
- type LocalCache
- func (cache LocalCache) Checkout(workspaceDir string, art artifact.Artifact, strat strategy.CheckoutStrategy) (err error)
- func (ch LocalCache) Commit(workspaceDir string, art *artifact.Artifact, strat strategy.CheckoutStrategy, ...) (err error)
- func (ch LocalCache) Fetch(workspaceDir, remoteSrc string, art artifact.Artifact) error
- func (ch LocalCache) PathForChecksum(checksum string) (string, error)
- func (ch LocalCache) Push(workspaceDir, remoteDst string, art artifact.Artifact) error
- func (ch LocalCache) Status(workspaceDir string, art artifact.Artifact) (outputStatus artifact.ArtifactWithStatus, err error)
- type MissingFromCacheError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Commit(workDir string, art *artifact.Artifact, s strategy.CheckoutStrategy, l *agglog.AggLogger) error Checkout(workDir string, art artifact.Artifact, s strategy.CheckoutStrategy) error Status(workDir string, art artifact.Artifact) (artifact.ArtifactWithStatus, error) Fetch(workDir, remoteSrc string, art artifact.Artifact) error Push(workDir, remoteDst string, art artifact.Artifact) error }
A Cache provides a means to store Artifacts.
type InvalidChecksumError ¶
type InvalidChecksumError struct {
// contains filtered or unexported fields
}
InvalidChecksumError is an error case where a valid checksum was expected but not found.
func (InvalidChecksumError) Error ¶
func (err InvalidChecksumError) Error() string
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
A LocalCache is a Cache that uses a directory on a local filesystem.
func NewLocalCache ¶
func NewLocalCache(dir string) (ch LocalCache, err error)
NewLocalCache initializes a LocalCache with a valid cache directory.
func (LocalCache) Checkout ¶
func (cache LocalCache) Checkout( workspaceDir string, art artifact.Artifact, strat strategy.CheckoutStrategy, ) (err error)
Checkout finds the artifact in the cache and adds a copy of/link to said artifact in the working directory.
func (LocalCache) Commit ¶
func (ch LocalCache) Commit( workspaceDir string, art *artifact.Artifact, strat strategy.CheckoutStrategy, logger *agglog.AggLogger, ) (err error)
Commit calculates the checksum of the artifact, moves it to the cache, then performs a checkout.
func (LocalCache) Fetch ¶
func (ch LocalCache) Fetch(workspaceDir, remoteSrc string, art artifact.Artifact) error
Fetch downloads an Artifact from a remote location to the local cache.
func (LocalCache) PathForChecksum ¶
func (ch LocalCache) PathForChecksum(checksum string) (string, error)
PathForChecksum returns the expected location of an object with the given checksum in the cache. If the checksum has an invalid (e.g. empty) checksum value, this function returns an error.
func (LocalCache) Push ¶
func (ch LocalCache) Push(workspaceDir, remoteDst string, art artifact.Artifact) error
Push uploads an Artifact from the local cache to a remote cache. TODO: Consider removing the workspaceDir argument. Technically Push and Fetch shouldn't care about the workspace at all; they purely interact with the local cache.
func (LocalCache) Status ¶
func (ch LocalCache) Status(workspaceDir string, art artifact.Artifact) ( outputStatus artifact.ArtifactWithStatus, err error, )
Status reports the status of an Artifact in the Cache.
type MissingFromCacheError ¶
type MissingFromCacheError struct {
// contains filtered or unexported fields
}
MissingFromCacheError is an error case where a cache file was expected but not found.
func (MissingFromCacheError) Error ¶
func (err MissingFromCacheError) Error() string