reg

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Overview

Package reg implements the OCI registry scheme used by most images (host:port/repo:tag)

Index

Constants

View Source
const OCISubjectHeader = "OCI-Subject"

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts func(*Reg)

Opts provides options to access registries

func WithBlobLimit added in v0.4.8

func WithBlobLimit(limit int64) Opts

WithBlobLimit overrides default blob limit

func WithBlobSize

func WithBlobSize(size, max int64) Opts

WithBlobSize overrides default blob sizes

func WithCache added in v0.5.1

func WithCache(timeout time.Duration, count int) Opts

WithCache defines a cache used for various requests

func WithCertDirs

func WithCertDirs(dirs []string) Opts

WithCertDirs adds certificate directories for host specific certs

func WithCertFiles

func WithCertFiles(files []string) Opts

WithCertFiles adds certificates by filename

func WithCerts

func WithCerts(certs [][]byte) Opts

WithCerts adds certificates

func WithConfigHosts

func WithConfigHosts(configHosts []*config.Host) Opts

WithConfigHosts adds host configs for credentials

func WithDelay

func WithDelay(delayInit time.Duration, delayMax time.Duration) Opts

WithDelay initial time to wait between retries (increased with exponential backoff)

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Opts

WithHTTPClient uses a specific http client with retryable requests

func WithLog

func WithLog(log *logrus.Logger) Opts

WithLog injects a logrus Logger configuration

func WithManifestMax added in v0.5.2

func WithManifestMax(push, pull int64) Opts

WithManifestMax sets the push and pull limits for manifests

func WithRetryLimit

func WithRetryLimit(l int) Opts

WithRetryLimit restricts the number of retries (defaults to 5)

func WithTransport

func WithTransport(t *http.Transport) Opts

WithTransport uses a specific http transport with retryable requests

func WithUserAgent

func WithUserAgent(ua string) Opts

WithUserAgent sets a user agent header

type Reg

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

Reg is used for interacting with remote registry servers

func New

func New(opts ...Opts) *Reg

New returns a Reg pointer with any provided options

func (*Reg) BlobDelete

func (reg *Reg) BlobDelete(ctx context.Context, r ref.Ref, d descriptor.Descriptor) error

BlobDelete removes a blob from the repository

func (*Reg) BlobGet

func (reg *Reg) BlobGet(ctx context.Context, r ref.Ref, d descriptor.Descriptor) (blob.Reader, error)

BlobGet retrieves a blob from the repository, returning a blob reader

func (*Reg) BlobHead

func (reg *Reg) BlobHead(ctx context.Context, r ref.Ref, d descriptor.Descriptor) (blob.Reader, error)

BlobHead is used to verify if a blob exists and is accessible

func (*Reg) BlobMount

func (reg *Reg) BlobMount(ctx context.Context, rSrc ref.Ref, rTgt ref.Ref, d descriptor.Descriptor) error

BlobMount attempts to perform a server side copy/mount of the blob between repositories

func (*Reg) BlobPut

func (reg *Reg) BlobPut(ctx context.Context, r ref.Ref, d descriptor.Descriptor, rdr io.Reader) (descriptor.Descriptor, error)

BlobPut uploads a blob to a repository. Descriptor is optional, leave size and digest to zero value if unknown. Reader must also be an io.Seeker to support chunked upload fallback.

This will attempt an anonymous blob mount first which some registries may support. It will then try doing a full put of the blob without chunking (most widely supported). If the full put fails, it will fall back to a chunked upload (useful for flaky networks).

func (*Reg) ManifestDelete

func (reg *Reg) ManifestDelete(ctx context.Context, r ref.Ref, opts ...scheme.ManifestOpts) error

ManifestDelete removes a manifest by reference (digest) from a registry. This will implicitly delete all tags pointing to that manifest.

func (*Reg) ManifestGet

func (reg *Reg) ManifestGet(ctx context.Context, r ref.Ref) (manifest.Manifest, error)

ManifestGet retrieves a manifest from the registry

func (*Reg) ManifestHead

func (reg *Reg) ManifestHead(ctx context.Context, r ref.Ref) (manifest.Manifest, error)

ManifestHead returns metadata on the manifest from the registry

func (*Reg) ManifestPut

func (reg *Reg) ManifestPut(ctx context.Context, r ref.Ref, m manifest.Manifest, opts ...scheme.ManifestOpts) error

ManifestPut uploads a manifest to a registry

func (*Reg) Ping added in v0.5.4

func (reg *Reg) Ping(ctx context.Context, r ref.Ref) (ping.Result, error)

Ping queries the /v2/ API of the registry to verify connectivity and access.

func (*Reg) ReferrerList added in v0.4.3

func (reg *Reg) ReferrerList(ctx context.Context, r ref.Ref, opts ...scheme.ReferrerOpts) (referrer.ReferrerList, error)

ReferrerList returns a list of referrers to a given reference

func (*Reg) RepoList

func (reg *Reg) RepoList(ctx context.Context, hostname string, opts ...scheme.RepoOpts) (*repo.RepoList, error)

RepoList returns a list of repositories on a registry Note the underlying "_catalog" API is not supported on many cloud registries

func (*Reg) TagDelete

func (reg *Reg) TagDelete(ctx context.Context, r ref.Ref) error

TagDelete removes a tag from a repository. It first attempts the newer OCI API to delete by tag name (not widely supported). If the OCI API fails, it falls back to pushing a unique empty manifest and deleting that.

func (*Reg) TagList

func (reg *Reg) TagList(ctx context.Context, r ref.Ref, opts ...scheme.TagOpts) (*tag.List, error)

TagList returns a listing to tags from the repository

func (*Reg) Throttle added in v0.5.0

func (reg *Reg) Throttle(r ref.Ref, put bool) []*throttle.Throttle

Throttle is used to limit concurrency

Jump to

Keyboard shortcuts

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