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 ¶
- type Registry
- func (r *Registry) BlobExists(ctx context.Context, digest string) (bool, error)
- func (r *Registry) BlobSize(ctx context.Context, digest string) (int64, error)
- func (r *Registry) DeleteBlob(ctx context.Context, digest string) error
- func (r *Registry) DeleteManifest(ctx context.Context, name, tag string) error
- func (r *Registry) DeleteManifestByDigest(ctx context.Context, name, digest string) error
- func (r *Registry) GetCatalog(ctx context.Context) (*manifest.Catalog, error)
- func (r *Registry) GetCatalogWithDigest(ctx context.Context) (*manifest.Catalog, string, error)
- func (r *Registry) ListTags(ctx context.Context, name string) ([]string, error)
- func (r *Registry) ManifestJSON(ctx context.Context, name, tag string) ([]byte, error)
- func (r *Registry) ManifestJSONByDigest(ctx context.Context, name, digest string) ([]byte, error)
- func (r *Registry) PushBlobFromStream(ctx context.Context, digest string, body io.Reader, size int64) error
- func (r *Registry) PushManifestJSON(ctx context.Context, name, tag string, data []byte) error
- func (r *Registry) PushManifestJSONByDigest(ctx context.Context, name string, data []byte) (string, error)
- func (r *Registry) StreamBlob(ctx context.Context, digest string) (io.ReadCloser, int64, error)
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 ¶
NewFromEnv creates a Registry using S3 configuration from environment variables.
func (*Registry) BlobExists ¶
BlobExists reports whether a blob with the given digest exists.
func (*Registry) DeleteBlob ¶
DeleteBlob removes a blob from the object store.
func (*Registry) DeleteManifest ¶
DeleteManifest removes a manifest tag and updates the catalog.
func (*Registry) DeleteManifestByDigest ¶ added in v0.2.1
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 ¶
GetCatalog returns the parsed global catalog index.
func (*Registry) GetCatalogWithDigest ¶ added in v0.1.7
GetCatalogWithDigest returns the parsed catalog and its SHA-256 digest.
func (*Registry) ManifestJSON ¶
ManifestJSON fetches a manifest by repository name and tag.
func (*Registry) ManifestJSONByDigest ¶ added in v0.1.7
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 ¶
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 ¶
StreamBlob returns a streaming reader and size. Caller must close the reader.