registryclient

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package registryclient is a small HTTP client for talking to an Epoch (or any OCI Distribution-compatible) registry. It implements just enough of the spec for epoch's CLI tools to push and pull blobs and manifests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the OCI Distribution endpoints epoch CLIs use.

All methods take a repository `name` so multi-segment names like `library/nginx` work; the client never tries to interpret it.

func New

func New(baseURL, token string) *Client

New creates a client for the given base URL and bearer token. Empty baseURL falls back to http://127.0.0.1:8080. The TLS config skips verification because epoch is commonly deployed behind a self-signed cert in dev.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the configured base URL.

func (*Client) BlobExists

func (c *Client) BlobExists(ctx context.Context, name, digest string) (bool, error)

BlobExists returns true if the blob is present in the repository's blob store. The digest must include the `sha256:` prefix.

func (*Client) Catalog added in v0.1.7

func (c *Client) Catalog(ctx context.Context) ([]string, error)

Catalog calls `GET /v2/_catalog` and returns the repository list.

func (*Client) DeleteManifest added in v0.1.7

func (c *Client) DeleteManifest(ctx context.Context, name, reference string) error

DeleteManifest calls `DELETE /v2/<name>/manifests/<reference>`.

func (*Client) GetBlob

func (c *Client) GetBlob(ctx context.Context, name, digest string) (io.ReadCloser, error)

GetBlob downloads a blob and returns the body for the caller to consume. The digest must include the `sha256:` prefix. Caller must close the body.

func (*Client) GetManifest

func (c *Client) GetManifest(ctx context.Context, name, tag string) ([]byte, string, error)

GetManifest downloads a manifest's raw bytes for `name:tag` and returns them along with the server-supplied Content-Type. Callers that need to classify the manifest pass the bytes to manifest.Classify.

func (*Client) ListTags added in v0.1.7

func (c *Client) ListTags(ctx context.Context, name string) ([]string, error)

ListTags calls `GET /v2/<name>/tags/list` and returns the tag list.

func (*Client) PutBlob

func (c *Client) PutBlob(ctx context.Context, name, digest string, body io.Reader, size int64) error

PutBlob uploads a blob via epoch's monolithic single-PUT shortcut at `PUT /v2/<name>/blobs/<digest>`. The digest must include the `sha256:` prefix.

func (*Client) PutManifest added in v0.1.7

func (c *Client) PutManifest(ctx context.Context, name, tag string, data []byte, contentType string) error

PutManifest uploads a manifest with the given content type. The OCI spec requires the Content-Type header to match the manifest's `mediaType` field; callers MUST pass the right value (typically MediaTypeOCIManifest).

Jump to

Keyboard shortcuts

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