push

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package push provides cross-repository blob mounting features for use during a push operation. Cross repository blob mounting works across repositories on the same registry. Note, cross-registry blob transfer is possible using a OCIFileCache backing store.

Index

Constants

View Source
const (
	// MountStatusSkipped indicates a case where no mountable sources were found.
	MountStatusSkipped = iota

	// MountStatusMounted indicates a successful mount was performed.
	MountStatusMounted

	// MountStatusUnavailable indicates alternate sources are specified, but do not match current registry.
	MountStatusUnavailable

	// MountStatusPushStarted indicates that a layer could not be mounted so the server started a push operation for
	// file transfer.
	MountStatusPushStarted

	// MountStatusMountRequired indicates that the "must mount" flag was set for a layer, but mounting was not
	// successful.
	MountStatusMountRequired

	// MountStatusFailure indicates a failure during the mount operation prevented success.
	MountStatusFailure
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LayerRepoList

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

LayerRepoList contains a list of repositories to attempt to use as the source of a layer in a cross-repo mount operation. For each list a boolean value stores whether or not the layer is flagged as "must mount", which can prevent an attempt to perform a standard file transfer if the mount attempt fails.

type LayerRepos

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

LayerRepos is a mapping of layer ids (digests) to a list of repos where the layer is suspected (or known) to exist.

func (*LayerRepos) AddSource

func (lr *LayerRepos) AddSource(ctx context.Context, layerID digest.Digest, source ref.Ref, mustMount bool)

AddSource adds a layerID, ref mapping to the layer repos collection.

func (*LayerRepos) IsMountable

func (lr *LayerRepos) IsMountable(ctx context.Context, layerID digest.Digest, destMount ref.Ref) bool

IsMountable returns true if the layerID is found on the destination registry in a different repo. False if not on the registry, or if the repository already contains the layerID.

func (*LayerRepos) MustMount

func (lr *LayerRepos) MustMount(ctx context.Context, layerID digest.Digest) bool

MustMount returns true if the must mount flag is set for the layerID.

func (*LayerRepos) Sources

func (lr *LayerRepos) Sources(ctx context.Context, layerID digest.Digest, destMount ref.Ref) []ref.Ref

Sources returns a list of possible repository sources for the provided layerID on the same registry, and not including the destination repository itself.

type LayerReposOption

type LayerReposOption func(*LayerRepos) error

LayerReposOption defines a function that operates on a LayerRepos to configure options.

type MountStatus

type MountStatus int

MountStatus is a status indicator type for a mountLayers attempt.

type MountableLayers

type MountableLayers interface {
	// IsMountable returns true if the provided layerID (digest) exists in a mountable layers provider. The destMount
	// parameter determines if the source and dest registries match, and also filters repositories that match exactly
	IsMountable(ctx context.Context, layerID digest.Digest, destMount ref.Ref) bool

	// MustMount returns true if the provided layerID MUST be mounted (eg. because it's unavailable for file transfer)
	MustMount(ctx context.Context, layerID digest.Digest) bool

	// Sources returns a slice of repository references that exist on the destination registry, and don't exactly
	// match the destination repository (not including tag)
	Sources(ctx context.Context, layerID digest.Digest, destMount ref.Ref) []ref.Ref

	// AddSource associates a given ref with the provided layer id (digest)
	AddSource(ctx context.Context, layerID digest.Digest, source ref.Ref, mustMount bool)
}

MountableLayers is an interface for providing information about known alternate repository sources for layerIDs. LayerIDs are intended to be digests with algorithm included, eg "sha256:b242feafa...".

func NewMountableLayerList

func NewMountableLayerList(opt ...LayerReposOption) (MountableLayers, error)

NewMountableLayerList creates a new collection of mountable layers and their known sources. By default, this is an empty list, and the MountableLayers Add() interface can be used to add repos,.

Jump to

Keyboard shortcuts

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