Documentation ¶
Index ¶
- type Memory
- func (m *Memory) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)
- func (m *Memory) Fetch(_ context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
- func (m *Memory) Map() map[descriptor.Descriptor][]byte
- func (m *Memory) Push(_ context.Context, expected ocispec.Descriptor, content io.Reader) error
- type Proxy
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 (*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.
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 ¶
NewProxyWithLimit creates a proxy for the `base` storage, using the `cache` storage with a push size limit as the cache.
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.