Documentation ¶
Overview ¶
Package ocimem provides a simple in-memory implementation of an OCI registry.
Index ¶
- func CheckDescriptor(desc ociregistry.Descriptor, data []byte) error
- func NewBytesReader(data []byte, desc ociregistry.Descriptor) ociregistry.BlobReader
- type Buffer
- func (b *Buffer) Cancel() error
- func (b *Buffer) ChunkSize() int
- func (b *Buffer) Close() error
- func (b *Buffer) Commit(dig ociregistry.Digest) (_ ociregistry.Descriptor, err error)
- func (b *Buffer) GetBlob() (ociregistry.Descriptor, []byte, error)
- func (b *Buffer) ID() string
- func (b *Buffer) Size() int64
- func (b *Buffer) Write(data []byte) (int, error)
- type Config
- type Registry
- func (r *Registry) DeleteBlob(ctx context.Context, repoName string, digest ociregistry.Digest) error
- func (r *Registry) DeleteManifest(ctx context.Context, repoName string, digest ociregistry.Digest) error
- func (r *Registry) DeleteTag(ctx context.Context, repoName string, tagName string) error
- func (r *Registry) GetBlob(ctx context.Context, repoName string, dig ociregistry.Digest) (ociregistry.BlobReader, error)
- func (r *Registry) GetBlobRange(ctx context.Context, repoName string, dig ociregistry.Digest, o0, o1 int64) (ociregistry.BlobReader, error)
- func (r *Registry) GetManifest(ctx context.Context, repoName string, dig ociregistry.Digest) (ociregistry.BlobReader, error)
- func (r *Registry) GetTag(ctx context.Context, repoName string, tagName string) (ociregistry.BlobReader, error)
- func (r *Registry) MountBlob(ctx context.Context, fromRepo, toRepo string, dig ociregistry.Digest) (ociregistry.Descriptor, error)
- func (r *Registry) PushBlob(ctx context.Context, repoName string, desc ociregistry.Descriptor, ...) (ociregistry.Descriptor, error)
- func (r *Registry) PushBlobChunked(ctx context.Context, repoName string, chunkSize int) (ociregistry.BlobWriter, error)
- func (r *Registry) PushBlobChunkedResume(ctx context.Context, repoName, id string, offset int64, chunkSize int) (ociregistry.BlobWriter, error)
- func (r *Registry) PushManifest(ctx context.Context, repoName string, tag string, data []byte, ...) (ociregistry.Descriptor, error)
- func (r *Registry) Referrers(ctx context.Context, repoName string, digest ociregistry.Digest, ...) ociregistry.Seq[ociregistry.Descriptor]
- func (r *Registry) Repositories(ctx context.Context, startAfter string) ociregistry.Seq[string]
- func (r *Registry) ResolveBlob(ctx context.Context, repoName string, digest ociregistry.Digest) (ociregistry.Descriptor, error)
- func (r *Registry) ResolveManifest(ctx context.Context, repoName string, digest ociregistry.Digest) (ociregistry.Descriptor, error)
- func (r *Registry) ResolveTag(ctx context.Context, repoName string, tagName string) (ociregistry.Descriptor, error)
- func (r *Registry) Tags(ctx context.Context, repoName string, startAfter string) ociregistry.Seq[string]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDescriptor ¶
func CheckDescriptor(desc ociregistry.Descriptor, data []byte) error
CheckDescriptor checks that the given descriptor matches the given data or, if data is nil, that the descriptor looks sane.
func NewBytesReader ¶
func NewBytesReader(data []byte, desc ociregistry.Descriptor) ociregistry.BlobReader
NewBytesReader returns an implementation of ociregistry.BlobReader that returns the given bytes. The returned reader will return desc from its Descriptor method.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer holds an in-memory implementation of ociregistry.BlobWriter.
func NewBuffer ¶
NewBuffer returns a buffer that calls commit with the when Buffer.Commit is invoked successfully. / It's OK to call methods concurrently on a buffer.
func (*Buffer) Commit ¶
func (b *Buffer) Commit(dig ociregistry.Digest) (_ ociregistry.Descriptor, err error)
Commit implements ociregistry.BlobWriter.Commit by checking that everything looks OK and calling the commit function if so.
func (*Buffer) GetBlob ¶
func (b *Buffer) GetBlob() (ociregistry.Descriptor, []byte, error)
GetBlob returns any committed data and is descriptor. It returns an error if the data hasn't been committed or there was an error doing so.
func (*Buffer) ID ¶
ID implements ociregistry.BlobWriter.ID by returning a randomly allocated hex UUID.
type Config ¶
type Config struct { // ImmutableTags specifies that tags in the registry cannot // be changed. Specifically the following restrictions are enforced: // - no removal of tags from a manifest // - no pushing of a tag if that tag already exists with a different // digest or media type. // - no deletion of directly tagged manifests // - no deletion of any blob or manifest that a tagged manifest // refers to (TODO: not implemented yet) ImmutableTags bool }
Config holds configuration for the registry.
type Registry ¶
type Registry struct { *ociregistry.Funcs // contains filtered or unexported fields }
func NewWithConfig ¶
NewWithConfig returns a new in-memory ociregistry.Interface implementation using the given configuration. If cfg is nil, it's treated the same as a pointer to the zero Config value.
func (*Registry) DeleteBlob ¶
func (*Registry) DeleteManifest ¶
func (*Registry) GetBlob ¶
func (r *Registry) GetBlob(ctx context.Context, repoName string, dig ociregistry.Digest) (ociregistry.BlobReader, error)
func (*Registry) GetBlobRange ¶
func (r *Registry) GetBlobRange(ctx context.Context, repoName string, dig ociregistry.Digest, o0, o1 int64) (ociregistry.BlobReader, error)
func (*Registry) GetManifest ¶
func (r *Registry) GetManifest(ctx context.Context, repoName string, dig ociregistry.Digest) (ociregistry.BlobReader, error)
func (*Registry) GetTag ¶
func (r *Registry) GetTag(ctx context.Context, repoName string, tagName string) (ociregistry.BlobReader, error)
func (*Registry) MountBlob ¶
func (r *Registry) MountBlob(ctx context.Context, fromRepo, toRepo string, dig ociregistry.Digest) (ociregistry.Descriptor, error)
func (*Registry) PushBlob ¶
func (r *Registry) PushBlob(ctx context.Context, repoName string, desc ociregistry.Descriptor, content io.Reader) (ociregistry.Descriptor, error)
func (*Registry) PushBlobChunked ¶
func (r *Registry) PushBlobChunked(ctx context.Context, repoName string, chunkSize int) (ociregistry.BlobWriter, error)
func (*Registry) PushBlobChunkedResume ¶
func (r *Registry) PushBlobChunkedResume(ctx context.Context, repoName, id string, offset int64, chunkSize int) (ociregistry.BlobWriter, error)
func (*Registry) PushManifest ¶
func (r *Registry) PushManifest(ctx context.Context, repoName string, tag string, data []byte, mediaType string) (ociregistry.Descriptor, error)
func (*Registry) Referrers ¶
func (r *Registry) Referrers(ctx context.Context, repoName string, digest ociregistry.Digest, artifactType string) ociregistry.Seq[ociregistry.Descriptor]
func (*Registry) Repositories ¶
func (*Registry) ResolveBlob ¶
func (r *Registry) ResolveBlob(ctx context.Context, repoName string, digest ociregistry.Digest) (ociregistry.Descriptor, error)
func (*Registry) ResolveManifest ¶
func (r *Registry) ResolveManifest(ctx context.Context, repoName string, digest ociregistry.Digest) (ociregistry.Descriptor, error)
func (*Registry) ResolveTag ¶
func (r *Registry) ResolveTag(ctx context.Context, repoName string, tagName string) (ociregistry.Descriptor, error)