Documentation
¶
Index ¶
- Constants
- func ErrCouldNotCreateClient(address string) error
- func ErrUnknownContentStoreType(contentStoreType ContentStoreType) error
- func GetContentStorePath(contentStoreType ContentStoreType, root string) (string, error)
- func IsErrAlreadyExists(err error) bool
- 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 NopCleanup(context.Context) error
- type BasicStore
- type CleanupFunc
- type ContainerdClient
- 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 ContentStoreConfig
- 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 = config.DefaultDaemonRootPath + "content" )
Variables ¶
This section is empty.
Functions ¶
func ErrCouldNotCreateClient ¶
func ErrUnknownContentStoreType ¶
func ErrUnknownContentStoreType(contentStoreType ContentStoreType) error
func GetContentStorePath ¶
func GetContentStorePath(contentStoreType ContentStoreType, root string) (string, error)
GetContentStorePath returns the top level directory for the content store.
func IsErrAlreadyExists ¶
IsErrAlreadyExists is a store-type-agnostic way to check if the content exists in the 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 NopCleanup ¶
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 ContainerdClient ¶
type ContainerdClient struct {
// contains filtered or unexported fields
}
This struct allows SOCI to create a connection to the containerd on-demand instead of on startup, allowing the daemon to start without containerd
func NewContainerdClient ¶
func NewContainerdClient(containerdAddress string) *ContainerdClient
func (*ContainerdClient) Client ¶
func (c *ContainerdClient) Client() (*containerd.Client, error)
type ContainerdStore ¶
type ContainerdStore struct {
ContentStoreConfig
}
func NewContainerdStore ¶
func NewContainerdStore(storeConfig ContentStoreConfig) (*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) 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 ContentStoreConfig ¶
type ContentStoreConfig struct {
config.ContentStoreConfig
SnapshotterRoot string
// contains filtered or unexported fields
}
func NewStoreConfig ¶
func NewStoreConfig(opts ...Option) ContentStoreConfig
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(*ContentStoreConfig)
func WithClient ¶
func WithClient(client *ContainerdClient) Option
func WithContainerdAddress ¶
This func will trim the leading 'unix://' if it is provided
func WithSnapshotterRoot ¶
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