memory

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: 9 Imported by: 18

Documentation

Overview

Package memory provides implementation of a memory backed content store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store represents a memory based store, which implements `oras.Target`.

func New

func New() *Store

New creates a new memory based store.

func (*Store) Exists

func (s *Store) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)

Exists returns true if the described content exists.

func (*Store) Fetch

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

Fetch fetches the content identified by the descriptor.

func (*Store) Predecessors

func (s *Store) Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)

Predecessors returns the nodes directly pointing to the current node. Predecessors returns nil without error if the node does not exists in the store. Like other operations, calling Predecessors() is go-routine safe. However, it does not necessarily correspond to any consistent snapshot of the stored contents.

func (*Store) Push

func (s *Store) Push(ctx context.Context, expected ocispec.Descriptor, reader io.Reader) error

Push pushes the content, matching the expected descriptor.

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)

Resolve resolves a reference to a descriptor.

func (*Store) Tag

func (s *Store) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error

Tag tags a descriptor with a reference string. Returns ErrNotFound if the tagged content does not exist.

Jump to

Keyboard shortcuts

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