Documentation ¶
Index ¶
- Constants
- func ErrUnknownContentStoreType(contentStoreType ContentStoreType) error
- func GetContentStorePath(contentStoreType ContentStoreType) (string, error)
- func LabelGCRefContent(ctx context.Context, store Store, target ocispec.Descriptor, ref string, ...) error
- func LabelGCRoot(ctx context.Context, store Store, target ocispec.Descriptor) error
- func NewStoreConfig(opts ...Option) config.ContentStoreConfig
- func NopCleanup(context.Context) error
- type BasicStore
- type CleanupFunc
- type ContainerdStore
- func (s *ContainerdStore) BatchOpen(ctx context.Context) (context.Context, CleanupFunc, error)
- func (s *ContainerdStore) Delete(ctx context.Context, dgst digest.Digest) error
- func (s *ContainerdStore) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
- func (s *ContainerdStore) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
- func (s *ContainerdStore) Label(ctx context.Context, target ocispec.Descriptor, name string, value string) error
- func (s *ContainerdStore) Push(ctx context.Context, expected ocispec.Descriptor, reader io.Reader) error
- type ContentStoreType
- type Option
- type SociStore
- type Store
Constants ¶
const ( ContainerdContentStoreType = config.ContainerdContentStoreType SociContentStoreType = config.SociContentStoreType )
const ( // Default path to containerd content addressable storage DefaultContainerdContentStorePath = "/var/lib/containerd/io.containerd.content.v1.content" // Default path to soci content addressable storage DefaultSociContentStorePath = "/var/lib/soci-snapshotter-grpc/content" )
Variables ¶
This section is empty.
Functions ¶
func ErrUnknownContentStoreType ¶
func ErrUnknownContentStoreType(contentStoreType ContentStoreType) error
func GetContentStorePath ¶
func GetContentStorePath(contentStoreType ContentStoreType) (string, error)
GetContentStorePath returns the top level directory for the content store.
func LabelGCRefContent ¶
func LabelGCRefContent(ctx context.Context, store Store, target ocispec.Descriptor, ref string, digest string) error
LabelGCRefContent labels the target resource to prevent garbage collection of another resource identified by digest with an optional ref to allow and disambiguate multiple content labels.
func LabelGCRoot ¶
LabelGCRoot labels the target resource to prevent garbage collection of itself.
func NewStoreConfig ¶
func NewStoreConfig(opts ...Option) config.ContentStoreConfig
func NopCleanup ¶ added in v0.7.0
Types ¶
type BasicStore ¶
type BasicStore interface { Exists(ctx context.Context, target ocispec.Descriptor) (bool, error) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error) Push(ctx context.Context, expected ocispec.Descriptor, reader io.Reader) error }
BasicStore describes the functionality common to oras-go oci.Store, oras-go memory.Store, and containerd ContentStore.
type CleanupFunc ¶
type ContainerdStore ¶
type ContainerdStore struct { config.ContentStoreConfig // contains filtered or unexported fields }
func NewContainerdStore ¶
func NewContainerdStore(ctx context.Context, storeConfig config.ContentStoreConfig) (context.Context, *ContainerdStore, error)
func (*ContainerdStore) BatchOpen ¶
func (s *ContainerdStore) BatchOpen(ctx context.Context) (context.Context, CleanupFunc, error)
BatchOpen creates a lease, ensuring that no content created within the batch will be garbage collected. It returns a cleanup function that ends the lease, which should be called after content is created and labeled.
func (*ContainerdStore) Delete ¶
func (s *ContainerdStore) Delete(ctx context.Context, dgst digest.Digest) error
Delete removes the described content.
func (*ContainerdStore) Exists ¶
func (s *ContainerdStore) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
Exists returns true iff the described content exists.
func (*ContainerdStore) Fetch ¶
func (s *ContainerdStore) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
Fetch fetches the content identified by the descriptor.
func (*ContainerdStore) Label ¶
func (s *ContainerdStore) Label(ctx context.Context, target ocispec.Descriptor, name string, value string) error
Label creates or updates the named label with the given value.
func (*ContainerdStore) Push ¶
func (s *ContainerdStore) Push(ctx context.Context, expected ocispec.Descriptor, reader io.Reader) error
Push pushes the content, matching the expected descriptor. This should be done within a Batch and followed by Label calls to prevent garbage collection.
type ContentStoreType ¶
type ContentStoreType = config.ContentStoreType
func CanonicalizeContentStoreType ¶
func CanonicalizeContentStoreType(contentStoreType ContentStoreType) (ContentStoreType, error)
CanonicalizeContentStoreType resolves the empty string to DefaultContentStoreType, returns other types, or errors on unrecognized types.
func ContentStoreTypes ¶
func ContentStoreTypes() []ContentStoreType
ContentStoreTypes returns a slice of all supported content store types.
type Option ¶
type Option func(*config.ContentStoreConfig)
func WithContainerdAddress ¶ added in v0.5.0
func WithNamespace ¶
func WithType ¶
func WithType(contentStoreType ContentStoreType) Option
type SociStore ¶
SociStore wraps oci.Store and adds or stubs additional functionality of the Store interface.
func NewSociStore ¶
NewSociStore creates a sociStore.
func (*SociStore) BatchOpen ¶
BatchOpen is a no-op for sociStore; it does not support batching operations.
type Store ¶
type Store interface { BasicStore Label(ctx context.Context, target ocispec.Descriptor, label string, value string) error Delete(ctx context.Context, dgst digest.Digest) error // BatchOpen starts a series of operations that should not be interrupted by garbage collection. // It returns a cleanup function that ends the batch, which should be called after // all associated content operations are finished. BatchOpen(ctx context.Context) (context.Context, CleanupFunc, error) }
Store extends BasicStore with functionality that in not present in some BasicStore implementations and may be stubbed in some Store implementations