artifactcache

package
v0.0.0-...-277eb20 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MB int64 = 1024 * 1024

Variables

This section is empty.

Functions

func NewTestArtifactCache

func NewTestArtifactCache(dir string, maxSize int64) (*testArtifactCache, error)

NewTestArtifactCache is only meant to be called from tests. Use New() instead.

Types

type ArtifactCache

type ArtifactCache struct {
	// contains filtered or unexported fields
}

ArtifactCache is a cache of downloaded artifacts from the ActiveState Platform. The State Tool prefers to use this cache instead of redownloading artifacts.

func New

func New() (*ArtifactCache, error)

New returns a new artifact cache in the State Tool's cache directory with the default maximum size of 1GB.

func (*ArtifactCache) Get

func (cache *ArtifactCache) Get(a strfmt.UUID) (string, bool)

Get returns the path to the cached artifact with the given id along with true if it exists. Otherwise returns an empty string and false. Updates the access timestamp if possible so that this artifact is not removed anytime soon.

func (*ArtifactCache) Save

func (cache *ArtifactCache) Save() error

Saves this cache's information to disk. You must call this function when you are done utilizing the cache.

func (*ArtifactCache) Store

func (cache *ArtifactCache) Store(a strfmt.UUID, archivePath string) error

Stores the given artifact in the cache. If the cache is too small, removes the least-recently accessed artifacts to make room.

Jump to

Keyboard shortcuts

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