Documentation ¶
Overview ¶
Package oci provides access to an OCI content store. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
Package oci provides access to an OCI content store. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
Index ¶
- type ReadOnlyStorage
- type ReadOnlyStore
- func (s *ReadOnlyStore) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
- func (s *ReadOnlyStore) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
- func (s *ReadOnlyStore) Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)
- func (s *ReadOnlyStore) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
- func (s *ReadOnlyStore) Tags(ctx context.Context, last string, fn func(tags []string) error) error
- type Storage
- type Store
- func (s *Store) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
- func (s *Store) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
- func (s *Store) Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)
- func (s *Store) Push(ctx context.Context, expected ocispec.Descriptor, reader io.Reader) error
- func (s *Store) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
- func (s *Store) SaveIndex() error
- func (s *Store) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error
- func (s *Store) Tags(ctx context.Context, last string, fn func(tags []string) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadOnlyStorage ¶
type ReadOnlyStorage struct {
// contains filtered or unexported fields
}
ReadOnlyStorage is a read-only CAS based on file system with the OCI-Image layout. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
func NewStorageFromFS ¶
func NewStorageFromFS(fsys fs.FS) *ReadOnlyStorage
NewStorageFromFS creates a new read-only CAS from fsys.
func NewStorageFromTar ¶
func NewStorageFromTar(path string) (*ReadOnlyStorage, error)
NewStorageFromTar creates a new read-only CAS from a tar archive located at path.
func (*ReadOnlyStorage) Exists ¶
func (s *ReadOnlyStorage) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)
Exists returns true if the described content Exists.
func (*ReadOnlyStorage) Fetch ¶
func (s *ReadOnlyStorage) Fetch(_ context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
Fetch fetches the content identified by the descriptor.
type ReadOnlyStore ¶
type ReadOnlyStore struct {
// contains filtered or unexported fields
}
ReadOnlyStore implements `oras.ReadonlyTarget`, and represents a read-only content store based on file system with the OCI-Image layout. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
func NewFromTar ¶
func NewFromTar(ctx context.Context, path string) (*ReadOnlyStore, error)
NewFromTar creates a new read-only OCI store from a tar archive located at path.
func (*ReadOnlyStore) Exists ¶
func (s *ReadOnlyStore) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
Exists returns true if the described content exists.
func (*ReadOnlyStore) Fetch ¶
func (s *ReadOnlyStore) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
Fetch fetches the content identified by the descriptor.
func (*ReadOnlyStore) Predecessors ¶
func (s *ReadOnlyStore) 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.
func (*ReadOnlyStore) Resolve ¶
func (s *ReadOnlyStore) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
Resolve resolves a reference to a descriptor.
func (*ReadOnlyStore) Tags ¶
Tags lists the tags presented in the `index.json` file of the OCI layout, returned in ascending order. If `last` is NOT empty, the entries in the response start after the tag specified by `last`. Otherwise, the response starts from the top of the tags list.
See also `Tags()` in the package `registry`.
type Storage ¶
type Storage struct { *ReadOnlyStorage // contains filtered or unexported fields }
Storage is a CAS based on file system with the OCI-Image layout. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
func NewStorage ¶
NewStorage creates a new CAS based on file system with the OCI-Image layout.
type Store ¶
type Store struct { // AutoSaveIndex controls if the OCI store will automatically save the index // file on each Tag() call. // If AutoSaveIndex is set to true, the OCI store will automatically call // this method on each Tag() call. // If AutoSaveIndex is set to false, it's the caller's responsibility // to manually call SaveIndex() when needed. // Default value: true. AutoSaveIndex bool // contains filtered or unexported fields }
Store implements `oras.Target`, and represents a content store based on file system with the OCI-Image layout. Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md
func NewWithContext ¶
NewWithContext creates a new OCI store.
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.
func (*Store) SaveIndex ¶
SaveIndex writes the `index.json` file to the file system. If AutoSaveIndex is set to true (default value), the OCI store will automatically call this method on each Tag() call. If AutoSaveIndex is set to false, it's the caller's responsibility to manually call this method when needed.
func (*Store) Tag ¶
Tag tags a descriptor with a reference string. reference should be a valid tag (e.g. "latest"). Reference: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc2/image-layout.md#indexjson-file
func (*Store) Tags ¶
Tags lists the tags presented in the `index.json` file of the OCI layout, returned in ascending order. If `last` is NOT empty, the entries in the response start after the tag specified by `last`. Otherwise, the response starts from the top of the tags list.
See also `Tags()` in the package `registry`.