cache

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheRootDir is the root directory for a cache
	CacheRootDir = "cache"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache handles local/in-memory storage of Helm charts, compliant with OCI Layout

func (*Cache) AddManifest

func (cache *Cache) AddManifest(ref *oci.Reference, manifest *ocispec.Descriptor) error

AddManifest provides a manifest to the cache index.json.

func (*Cache) DeleteReference

func (cache *Cache) DeleteReference(ref *oci.Reference) (*CacheRefSummary, error)

DeleteReference deletes a chart ref from cache TODO: garbage collection, only manifest removed

func (*Cache) FetchReference

func (cache *Cache) FetchReference(ref *oci.Reference) (*CacheRefSummary, error)

FetchReference retrieves a model ref from cache.

func (*Cache) Ingester

func (cache *Cache) Ingester() content.Ingester

Ingester provides a valid containerd Ingester

func (*Cache) ListReferences

func (cache *Cache) ListReferences() ([]*CacheRefSummary, error)

ListReferences lists all chart refs in a cache

func (*Cache) ProvideIngester

func (cache *Cache) ProvideIngester() orascontent.ProvideIngester

ProvideIngester provides a valid oras ProvideIngester

func (*Cache) Provider

func (cache *Cache) Provider() content.Provider

Provider provides a valid containerd Provider

func (*Cache) StoreReference

func (cache *Cache) StoreReference(ref *oci.Reference, m *model.Model) (*CacheRefSummary, error)

StoreReference stores a model ref in cache

func (*Cache) TagReference

func (cache *Cache) TagReference(ref *oci.Reference, target *oci.Reference) error

TagReference tags the reference to the target.

type CacheOption

type CacheOption func(*Cache)

CacheOption allows specifying various settings configurable by the user for overriding the defaults used when creating a new default cache

func CacheOptDebug

func CacheOptDebug(debug bool) CacheOption

CacheOptDebug returns a function that sets the debug setting on cache options set

func CacheOptRoot

func CacheOptRoot(rootDir string) CacheOption

CacheOptRoot returns a function that sets the root directory setting on cache options set

func CacheOptWriter

func CacheOptWriter(out io.Writer) CacheOption

CacheOptWriter returns a function that sets the writer setting on cache options set

type CacheRefSummary

type CacheRefSummary struct {
	Name         string
	Repo         string
	Tag          string
	Exists       bool
	Manifest     *ocispec.Descriptor
	Config       *ocispec.Descriptor
	ContentLayer *ocispec.Descriptor
	Size         int64
	Digest       digest.Digest
	CreatedAt    time.Time
	Model        *model.Model
}

CacheRefSummary contains as much info as available describing a chart reference in cache Note: fields here are sorted by the order in which they are set in FetchReference method

type Interface

type Interface interface {
	FetchReference(ref *oci.Reference) (*CacheRefSummary, error)
	StoreReference(ref *oci.Reference, m *model.Model) (*CacheRefSummary, error)
	DeleteReference(ref *oci.Reference) (*CacheRefSummary, error)
	ListReferences() ([]*CacheRefSummary, error)
	AddManifest(ref *oci.Reference, manifest *ocispec.Descriptor) error
	TagReference(ref *oci.Reference, target *oci.Reference) error
	Provider() content.Provider
	Ingester() content.Ingester
	ProvideIngester() orascontent.ProvideIngester
}

Interface is the interface of the cache.

func New

func New(opts ...CacheOption) (Interface, error)

New returns a new OCI Layout-compliant cache with config

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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