remotes

package
v1.7.15 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 1,303

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch added in v1.7.0

func Fetch(ctx context.Context, ingester content.Ingester, fetcher Fetcher, desc ocispec.Descriptor) error

Fetch fetches the given digest into the provided ingester

func FetchHandler

func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc

FetchHandler returns a handler that will fetch all content into the ingester discovered in a call to Dispatch. Use with ChildrenHandler to do a full recursive fetch.

func FilterManifestByPlatformHandler added in v1.3.0

func FilterManifestByPlatformHandler(f images.HandlerFunc, m platforms.Matcher) images.HandlerFunc

FilterManifestByPlatformHandler allows Handler to handle non-target platform's manifest and configuration data.

func MakeRefKey

func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string

MakeRefKey returns a unique reference for the descriptor. This reference can be used to lookup ongoing processes related to the descriptor. This function may look to the context to namespace the reference appropriately.

func PushContent added in v1.1.0

func PushContent(ctx context.Context, pusher Pusher, desc ocispec.Descriptor, store content.Provider, limiter *semaphore.Weighted, platform platforms.MatchComparer, wrapper func(h images.Handler) images.Handler) error

PushContent pushes content specified by the descriptor from the provider.

Base handlers can be provided which will be called before any push specific handlers.

If the passed in content.Provider is also a content.InfoProvider (such as content.Manager) then this will also annotate the distribution sources using labels prefixed with "containerd.io/distribution.source".

func PushHandler

func PushHandler(pusher Pusher, provider content.Provider) images.HandlerFunc

PushHandler returns a handler that will push all content from the provider using a writer from the pusher.

func SkipNonDistributableBlobs added in v1.6.0

func SkipNonDistributableBlobs(f images.HandlerFunc) images.HandlerFunc

SkipNonDistributableBlobs returns a handler that skips blobs that have a media type that is "non-distributeable". An example of this kind of content would be a Windows base layer, which is not supposed to be redistributed.

This is based on the media type of the content:

  • application/vnd.oci.image.layer.nondistributable
  • application/vnd.docker.image.rootfs.foreign

func WithMediaTypeKeyPrefix added in v1.3.0

func WithMediaTypeKeyPrefix(ctx context.Context, mediaType, prefix string) context.Context

WithMediaTypeKeyPrefix adds a custom key prefix for a media type which is used when storing data in the content store from the FetchHandler.

Used in `MakeRefKey` to determine what the key prefix should be.

Types

type Fetcher

type Fetcher interface {
	// Fetch the resource identified by the descriptor.
	Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
}

Fetcher fetches content. A fetcher implementation may implement the FetcherByDigest interface too.

type FetcherByDigest added in v1.7.0

type FetcherByDigest interface {
	// FetchByDigest fetches the resource identified by the digest.
	//
	// FetcherByDigest usually returns an incomplete descriptor.
	// Typically, the media type is always set to "application/octet-stream",
	// and the annotations are unset.
	FetchByDigest(ctx context.Context, dgst digest.Digest) (io.ReadCloser, ocispec.Descriptor, error)
}

FetcherByDigest fetches content by the digest.

type FetcherFunc

type FetcherFunc func(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)

FetcherFunc allows package users to implement a Fetcher with just a function.

func (FetcherFunc) Fetch

Fetch content

type Pusher

type Pusher interface {
	// Push returns a content writer for the given resource identified
	// by the descriptor.
	Push(ctx context.Context, d ocispec.Descriptor) (content.Writer, error)
}

Pusher pushes content

type PusherFunc

type PusherFunc func(ctx context.Context, desc ocispec.Descriptor) (content.Writer, error)

PusherFunc allows package users to implement a Pusher with just a function.

func (PusherFunc) Push

Push content

type Resolver

type Resolver interface {
	// Resolve attempts to resolve the reference into a name and descriptor.
	//
	// The argument `ref` should be a scheme-less URI representing the remote.
	// Structurally, it has a host and path. The "host" can be used to directly
	// reference a specific host or be matched against a specific handler.
	//
	// The returned name should be used to identify the referenced entity.
	// Depending on the remote namespace, this may be immutable or mutable.
	// While the name may differ from ref, it should itself be a valid ref.
	//
	// If the resolution fails, an error will be returned.
	Resolve(ctx context.Context, ref string) (name string, desc ocispec.Descriptor, err error)

	// Fetcher returns a new fetcher for the provided reference.
	// All content fetched from the returned fetcher will be
	// from the namespace referred to by ref.
	Fetcher(ctx context.Context, ref string) (Fetcher, error)

	// Pusher returns a new pusher for the provided reference
	// The returned Pusher should satisfy content.Ingester and concurrent attempts
	// to push the same blob using the Ingester API should result in ErrUnavailable.
	Pusher(ctx context.Context, ref string) (Pusher, error)
}

Resolver provides remotes based on a locator.

Directories

Path Synopsis
config
Package config contains utilities for helping configure the Docker resolver
Package config contains utilities for helping configure the Docker resolver
schema1
Package schema1 provides a converter to fetch an image formatted in Docker Image Manifest v2, Schema 1.
Package schema1 provides a converter to fetch an image formatted in Docker Image Manifest v2, Schema 1.

Jump to

Keyboard shortcuts

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