distribution

package
v25.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeprecatedSchema1ImageMessage

func DeprecatedSchema1ImageMessage(ref reference.Named) string

func GetRepositories

func GetRepositories(ctx context.Context, ref reference.Named, config *ImagePullConfig) ([]distribution.Repository, error)

GetRepositories returns a list of repositories configured for the given reference. Multiple repositories can be returned if the reference is for the default (Docker Hub) registry and a mirror is configured, but it omits registries that were not reachable (pinging the /v2/ endpoint failed).

It returns an error if it was unable to reach any of the registries for the given reference, or if the provided reference is invalid.

func Pull

func Pull(ctx context.Context, ref reference.Named, config *ImagePullConfig, local ContentStore) error

Pull initiates a pull operation. image is the repository name to pull, and tag may be either empty, or indicate a specific tag to pull.

func Push

func Push(ctx context.Context, ref reference.Named, config *ImagePushConfig) error

Push initiates a push operation on ref. ref is the specific variant of the image to push. If no tag is provided, all tags are pushed.

func Tags

func Tags(ctx context.Context, ref reference.Named, config *Config) ([]string, error)

Tags returns available tags for the given image in the remote repository.

Types

type Config

type Config struct {
	// MetaHeaders stores HTTP headers with metadata about the image
	MetaHeaders map[string][]string
	// AuthConfig holds authentication credentials for authenticating with
	// the registry.
	AuthConfig *registry.AuthConfig
	// ProgressOutput is the interface for showing the status of the pull
	// operation.
	ProgressOutput progress.Output
	// RegistryService is the registry service to use for TLS configuration
	// and endpoint lookup.
	RegistryService RegistryResolver
	// ImageEventLogger notifies events for a given image
	ImageEventLogger func(id, name string, action events.Action)
	// MetadataStore is the storage backend for distribution-specific
	// metadata.
	MetadataStore metadata.Store
	// ImageStore manages images.
	ImageStore ImageConfigStore
	// ReferenceStore manages tags. This value is optional, when excluded
	// content will not be tagged.
	ReferenceStore refstore.Store
}

Config stores configuration for communicating with a registry.

type ContentStore

type ContentStore interface {
	content.Ingester
	content.Provider
	Info(ctx context.Context, dgst digest.Digest) (content.Info, error)
	Abort(ctx context.Context, ref string) error
	Update(ctx context.Context, info content.Info, fieldpaths ...string) (content.Info, error)
}

ContentStore is the interface used to persist registry blobs

Currently this is only used to persist manifests and manifest lists. It is exported because `distribution.Pull` takes one as an argument.

type ImageConfigStore

type ImageConfigStore interface {
	Put(context.Context, []byte) (digest.Digest, error)
	Get(context.Context, digest.Digest) ([]byte, error)
}

ImageConfigStore handles storing and getting image configurations by digest. Allows getting an image configurations rootfs from the configuration.

func NewImageConfigStoreFromStore

func NewImageConfigStoreFromStore(is image.Store) ImageConfigStore

NewImageConfigStoreFromStore returns an ImageConfigStore backed by an image.Store for container images.

type ImagePullConfig

type ImagePullConfig struct {
	Config

	// DownloadManager manages concurrent pulls.
	DownloadManager *xfer.LayerDownloadManager
	// Schema2Types is an optional list of valid schema2 configuration types
	// allowed by the pull operation. If omitted, the default list of accepted
	// types is used.
	Schema2Types []string
	// Platform is the requested platform of the image being pulled
	Platform *ocispec.Platform
}

ImagePullConfig stores pull configuration.

type ImagePushConfig

type ImagePushConfig struct {
	Config

	// ConfigMediaType is the configuration media type for
	// schema2 manifests.
	ConfigMediaType string
	// LayerStores manages layers.
	LayerStores PushLayerProvider
	// UploadManager dispatches uploads.
	UploadManager *xfer.LayerUploadManager
}

ImagePushConfig stores push configuration.

type PushLayer

type PushLayer interface {
	ChainID() layer.ChainID
	DiffID() layer.DiffID
	Parent() PushLayer
	Open() (io.ReadCloser, error)
	Size() int64
	MediaType() string
	Release()
}

PushLayer is a pushable layer with metadata about the layer and access to the content of the layer.

type PushLayerProvider

type PushLayerProvider interface {
	Get(layer.ChainID) (PushLayer, error)
}

PushLayerProvider provides layers to be pushed by ChainID.

func NewLayerProvidersFromStore

func NewLayerProvidersFromStore(ls layer.Store) PushLayerProvider

NewLayerProvidersFromStore returns layer providers backed by an instance of LayerStore. Only getting layers as gzipped tars is supported.

type RegistryResolver

type RegistryResolver interface {
	LookupPushEndpoints(hostname string) (endpoints []registrypkg.APIEndpoint, err error)
	LookupPullEndpoints(hostname string) (endpoints []registrypkg.APIEndpoint, err error)
	ResolveRepository(name reference.Named) (*registrypkg.RepositoryInfo, error)
}

RegistryResolver is used for TLS configuration and endpoint lookup.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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