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 ¶
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) BlobExists(ctx context.Context, name, digest string) (bool, error)
- func (c *Client) Catalog(ctx context.Context) ([]string, error)
- func (c *Client) DeleteManifest(ctx context.Context, name, reference string) error
- func (c *Client) GetBlob(ctx context.Context, name, digest string) (io.ReadCloser, error)
- func (c *Client) GetManifest(ctx context.Context, name, tag string) ([]byte, string, error)
- func (c *Client) ListTags(ctx context.Context, name string) ([]string, error)
- func (c *Client) PutBlob(ctx context.Context, name, digest string, body io.Reader, size int64) error
- func (c *Client) PutManifest(ctx context.Context, name, tag string, data []byte, contentType string) error
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 ¶
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) BlobExists ¶
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
Catalog calls `GET /v2/_catalog` and returns the repository list.
func (*Client) DeleteManifest ¶ added in v0.1.7
DeleteManifest calls `DELETE /v2/<name>/manifests/<reference>`.
func (*Client) GetBlob ¶
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 ¶
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
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).