distribution

package
v0.0.1-0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepository

func GetRepository(ctx context.Context, ref reference.Named, config *ImagePullConfig) (repository distribution.Repository, lastError error)

GetRepository returns a repository from the registry.

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.

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, action string)
	// 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 *specs.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