registry

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package registry stores and retrieves OCI blobs and manifests in S3, plus maintains a global catalog index. Vendor-agnostic; cocoonstack concepts live in the snapshot and cloudimg packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry is the storage facade. Safe for concurrent use.

func New

func New(client *objectstore.Client) *Registry

New creates a Registry backed by the given object store client.

func NewFromEnv

func NewFromEnv() (*Registry, error)

NewFromEnv creates a Registry using S3 configuration from environment variables.

func (*Registry) BlobExists

func (r *Registry) BlobExists(ctx context.Context, digest string) (bool, error)

BlobExists reports whether a blob with the given digest exists.

func (*Registry) BlobSize

func (r *Registry) BlobSize(ctx context.Context, digest string) (int64, error)

BlobSize returns the size of a blob in bytes.

func (*Registry) DeleteBlob

func (r *Registry) DeleteBlob(ctx context.Context, digest string) error

DeleteBlob removes a blob from the object store.

func (*Registry) DeleteManifest

func (r *Registry) DeleteManifest(ctx context.Context, name, tag string) error

DeleteManifest removes a manifest tag and updates the catalog.

func (*Registry) DeleteManifestByDigest added in v0.2.1

func (r *Registry) DeleteManifestByDigest(ctx context.Context, name, digest string) error

DeleteManifestByDigest removes the digest-addressed manifest copy and unlinks every tag whose content resolves to the same digest, as required by the OCI distribution spec (end-2b: "The tags and references to the manifest MUST be removed from the registry if the manifest is deleted.").

Returns ErrNotFound when the digest copy does not exist, so callers can surface the canonical 404 instead of a silent 202 after the object store swallows the missing-object error on Delete.

Unlinking runs BEFORE the digest copy is removed so the operation stays retryable: a partial failure leaves the digest file in place, and a retry re-enters this function, re-lists surviving tags, and resumes cleanup. unlinkTagsByDigest is itself idempotent — object-store Delete swallows not-found and removeCatalogEntry is a no-op on missing entries.

func (*Registry) GetCatalog

func (r *Registry) GetCatalog(ctx context.Context) (*manifest.Catalog, error)

GetCatalog returns the parsed global catalog index.

func (*Registry) GetCatalogWithDigest added in v0.1.7

func (r *Registry) GetCatalogWithDigest(ctx context.Context) (*manifest.Catalog, string, error)

GetCatalogWithDigest returns the parsed catalog and its SHA-256 digest.

func (*Registry) ListTags

func (r *Registry) ListTags(ctx context.Context, name string) ([]string, error)

ListTags returns all tags for a repository, skipping by-digest copies.

func (*Registry) ManifestJSON

func (r *Registry) ManifestJSON(ctx context.Context, name, tag string) ([]byte, error)

ManifestJSON fetches a manifest by repository name and tag.

func (*Registry) ManifestJSONByDigest added in v0.1.7

func (r *Registry) ManifestJSONByDigest(ctx context.Context, name, digest string) ([]byte, error)

ManifestJSONByDigest fetches a manifest by repository name and content digest.

func (*Registry) PushBlobFromStream

func (r *Registry) PushBlobFromStream(ctx context.Context, digest string, body io.Reader, size int64) error

PushBlobFromStream uploads a blob, deduplicating if it already exists.

func (*Registry) PushManifestJSON

func (r *Registry) PushManifestJSON(ctx context.Context, name, tag string, data []byte) error

PushManifestJSON uploads a manifest under both the tag and digest keys, then updates the catalog.

func (*Registry) PushManifestJSONByDigest added in v0.1.7

func (r *Registry) PushManifestJSONByDigest(ctx context.Context, name string, data []byte) (string, error)

PushManifestJSONByDigest stores a manifest by digest only (no tag, no catalog update). Used for OCI index child manifests. Returns the computed digest.

func (*Registry) StreamBlob

func (r *Registry) StreamBlob(ctx context.Context, digest string) (io.ReadCloser, int64, error)

StreamBlob returns a streaming reader and size. Caller must close the reader.

Jump to

Keyboard shortcuts

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