scheme

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: 10 Imported by: 1

Documentation

Overview

Package scheme defines the interface for various reference schemes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReferrerFilter added in v0.4.6

func ReferrerFilter(config ReferrerConfig, rlIn referrer.ReferrerList) referrer.ReferrerList

ReferrerFilter filters the referrer list according to the config.

Types

type API

type API interface {
	// BlobDelete removes a blob from the repository.
	BlobDelete(ctx context.Context, r ref.Ref, d descriptor.Descriptor) error
	// BlobGet retrieves a blob, returning a reader.
	BlobGet(ctx context.Context, r ref.Ref, d descriptor.Descriptor) (blob.Reader, error)
	// BlobHead verifies the existence of a blob, the reader contains the headers but no body to read.
	BlobHead(ctx context.Context, r ref.Ref, d descriptor.Descriptor) (blob.Reader, error)
	// BlobMount attempts to perform a server side copy of the blob.
	BlobMount(ctx context.Context, refSrc ref.Ref, refTgt ref.Ref, d descriptor.Descriptor) error
	// BlobPut sends a blob to the repository, returns the digest and size when successful.
	BlobPut(ctx context.Context, r ref.Ref, d descriptor.Descriptor, rdr io.Reader) (descriptor.Descriptor, error)

	// ManifestDelete removes a manifest, including all tags that point to that manifest.
	ManifestDelete(ctx context.Context, r ref.Ref, opts ...ManifestOpts) error
	// ManifestGet retrieves a manifest from a repository.
	ManifestGet(ctx context.Context, r ref.Ref) (manifest.Manifest, error)
	// ManifestHead gets metadata about the manifest (existence, digest, mediatype, size).
	ManifestHead(ctx context.Context, r ref.Ref) (manifest.Manifest, error)
	// ManifestPut sends a manifest to the repository.
	ManifestPut(ctx context.Context, r ref.Ref, m manifest.Manifest, opts ...ManifestOpts) error

	// Ping verifies access to a registry or equivalent.
	Ping(ctx context.Context, r ref.Ref) (ping.Result, error)

	// ReferrerList returns a list of referrers to a given reference.
	ReferrerList(ctx context.Context, r ref.Ref, opts ...ReferrerOpts) (referrer.ReferrerList, error)

	// TagDelete removes a tag from the repository.
	TagDelete(ctx context.Context, r ref.Ref) error
	// TagList returns a list of tags from the repository.
	TagList(ctx context.Context, r ref.Ref, opts ...TagOpts) (*tag.List, error)
}

API is used to interface between different methods to store images.

type Closer

type Closer interface {
	Close(ctx context.Context, r ref.Ref) error
}

Closer is used to check if a scheme implements the Close API.

type GCLocker added in v0.5.0

type GCLocker interface {
	// GCLock a reference to prevent GC from triggering during a put, locks are not exclusive.
	GCLock(r ref.Ref)
	// GCUnlock a reference to allow GC (once all locks are released).
	// The reference should be closed after this step and unlock should only be called once per each Lock call.
	GCUnlock(r ref.Ref)
}

GCLocker is used to indicate locking is available for GC management.

type ManifestConfig

type ManifestConfig struct {
	CheckReferrers bool
	Child          bool // used when pushing a child of a manifest list, skips indexing in ocidir
	Manifest       manifest.Manifest
}

ManifestConfig is used by schemes to import ManifestOpts.

type ManifestOpts

type ManifestOpts func(*ManifestConfig)

ManifestOpts is used to set options on manifest APIs.

func WithManifest added in v0.4.5

func WithManifest(m manifest.Manifest) ManifestOpts

WithManifest is used to pass the manifest to a method to avoid an extra GET request. This is used on a delete to check for referrers.

func WithManifestCheckReferrers added in v0.4.5

func WithManifestCheckReferrers() ManifestOpts

WithManifestCheckReferrers is used when deleting a manifest. It indicates the manifest should be fetched and referrers should be deleted if defined.

func WithManifestChild

func WithManifestChild() ManifestOpts

WithManifestChild indicates the API call is on a child manifest. This is used internally when copying multi-platform manifests. This bypasses tracking of an untagged digest in ocidir which is needed for garbage collection.

type ReferrerConfig added in v0.4.3

type ReferrerConfig struct {
	MatchOpt descriptor.MatchOpt // filter/sort results
	Platform string              // get referrers for a specific platform
}

ReferrerConfig is used by schemes to import ReferrerOpts.

type ReferrerOpts added in v0.4.3

type ReferrerOpts func(*ReferrerConfig)

ReferrerOpts is used to set options on referrer APIs.

func WithReferrerAT deprecated added in v0.4.5

func WithReferrerAT(at string) ReferrerOpts

WithReferrerAT filters by a specific artifactType value.

Deprecated: replace with WithReferrerMatchOpt.

func WithReferrerAnnotations deprecated added in v0.4.5

func WithReferrerAnnotations(annotations map[string]string) ReferrerOpts

WithReferrerAnnotations filters by a list of annotations, all of which must match.

Deprecated: replace with WithReferrerMatchOpt.

func WithReferrerMatchOpt added in v0.5.2

func WithReferrerMatchOpt(mo descriptor.MatchOpt) ReferrerOpts

WithReferrerMatchOpt filters results using descriptor.MatchOpt.

func WithReferrerPlatform added in v0.4.6

func WithReferrerPlatform(p string) ReferrerOpts

WithReferrerPlatform gets referrers for a single platform from a multi-platform manifest.

func WithReferrerSort deprecated added in v0.5.0

func WithReferrerSort(annotation string, desc bool) ReferrerOpts

WithReferrerSort orders the resulting referrers listing according to a specified annotation.

Deprecated: replace with WithReferrerMatchOpt.

type RepoConfig

type RepoConfig struct {
	Limit int
	Last  string
}

RepoConfig is used by schemes to import RepoOpts.

type RepoOpts

type RepoOpts func(*RepoConfig)

RepoOpts is used to set options on repo APIs.

func WithRepoLast

func WithRepoLast(l string) RepoOpts

WithRepoLast passes the last received repository for requesting the next batch of repositories. Registries may ignore this.

func WithRepoLimit

func WithRepoLimit(l int) RepoOpts

WithRepoLimit passes a maximum number of repositories to return to the repository list API. Registries may ignore this.

type TagConfig

type TagConfig struct {
	Limit int
	Last  string
}

TagConfig is used by schemes to import TagOpts.

type TagOpts

type TagOpts func(*TagConfig)

TagOpts is used to set options on tag APIs.

func WithTagLast

func WithTagLast(last string) TagOpts

WithTagLast passes the last received tag for requesting the next batch of tags. Registries may ignore this.

func WithTagLimit

func WithTagLimit(limit int) TagOpts

WithTagLimit passes a maximum number of tags to return to the tag list API. Registries may ignore this.

type Throttler added in v0.5.0

type Throttler interface {
	Throttle(r ref.Ref, put bool) []*throttle.Throttle
}

Throttler is used to indicate the scheme implements Throttle.

Directories

Path Synopsis
Package ocidir implements the OCI Image Layout scheme with a directory (not packed in a tar)
Package ocidir implements the OCI Image Layout scheme with a directory (not packed in a tar)
Package reg implements the OCI registry scheme used by most images (host:port/repo:tag)
Package reg implements the OCI registry scheme used by most images (host:port/repo:tag)

Jump to

Keyboard shortcuts

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