cas

package
v2.0.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

Memory is a memory based CAS.

func NewMemory

func NewMemory() *Memory

NewMemory creates a new Memory CAS.

func (*Memory) Exists

func (m *Memory) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)

Exists returns true if the described content exists.

func (*Memory) Fetch

func (m *Memory) Fetch(_ context.Context, target ocispec.Descriptor) (io.ReadCloser, error)

Fetch fetches the content identified by the descriptor.

func (*Memory) Map

func (m *Memory) Map() map[descriptor.Descriptor][]byte

Map dumps the memory into a built-in map structure. Like other operations, calling Map() is go-routine safe. However, it does not necessarily correspond to any consistent snapshot of the storage contents.

func (*Memory) Push

func (m *Memory) Push(_ context.Context, expected ocispec.Descriptor, content io.Reader) error

Push pushes the content, matching the expected descriptor.

type Proxy

type Proxy struct {
	content.ReadOnlyStorage
	Cache       content.Storage
	StopCaching bool
}

Proxy is a caching proxy for the storage. The first fetch call of a described content will read from the remote and cache the fetched content. The subsequent fetch call will read from the local cache.

func NewProxy

func NewProxy(base content.ReadOnlyStorage, cache content.Storage) *Proxy

NewProxy creates a proxy for the `base` storage, using the `cache` storage as the cache.

func NewProxyWithLimit

func NewProxyWithLimit(base content.ReadOnlyStorage, cache content.Storage, pushLimit int64) *Proxy

NewProxyWithLimit creates a proxy for the `base` storage, using the `cache` storage with a push size limit as the cache.

func (*Proxy) Exists

func (p *Proxy) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)

Exists returns true if the described content exists.

func (*Proxy) Fetch

func (p *Proxy) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)

Fetch fetches the content identified by the descriptor.

func (*Proxy) FetchCached

func (p *Proxy) FetchCached(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)

FetchCached fetches the content identified by the descriptor. If the content is not cached, it will be fetched from the remote without caching.

Jump to

Keyboard shortcuts

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