Documentation
¶
Index ¶
- func BuildLayersDictionary(manifests ...manifest.Manifest) map[digest.Digest]bool
- func FetchManifests(ctx context.Context, from types.ImageReference, sysctx *types.SystemContext) ([]manifest.Manifest, error)
- func ProcessList(ctx context.Context, fromref types.ImageSource, raw []byte, mime string) ([]manifest.Manifest, error)
- type Authentications
- type Incremental
- type Option
- type RemoveOnClose
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLayersDictionary ¶ added in v0.0.6
BuildLayersDictionary goes through all the provided manifests and indexes all the layers by their digest in a map. The value of each entry in the map is a boolean that is always true.
func FetchManifests ¶ added in v0.0.6
func FetchManifests(ctx context.Context, from types.ImageReference, sysctx *types.SystemContext) ([]manifest.Manifest, error)
fetchManifests returns the list of manifests that are present in the source image. In case of a manifest list it will iterate over the children and return them.
Types ¶
type Authentications ¶
type Authentications struct { BaseAuth *types.DockerAuthConfig FinalAuth *types.DockerAuthConfig PushAuth *types.DockerAuthConfig }
Authentications holds the all the necessary authentications for the incremental operations. BaseAuth is the authentication for the base image, FinalAuth is the authentication for the final image and PushAuth is the authentication for the destination registry. For example, let's suppose we want to get an incremental difference between an imaged hosted on X registry and an image hosted on Y registry and late on we want to push the difference to Z registry. In this case: - BaseAuth is the authentication for the X registry. - FinalAuth is the authentication for the Y registry. - PushAuth is the authentication for the Z registry.
type Incremental ¶
type Incremental struct {
// contains filtered or unexported fields
}
Incremental provides tooling about getting (Pull) or sending (Push) the difference between two images. The difference is calculated between the base and final images. When Pushing the difference to a destination registry it is important to note that the other layers (the ones not included in the 'difference') exist.
func New ¶
func New(opts ...Option) *Incremental
New returns a new Incremental object. With Incremental objects callers can calculate the incremental difference between two images (Pull) or send the incremental towards a destination (Push).
func (*Incremental) Pull ¶
func (inc *Incremental) Pull(ctx context.Context, base, final string) (io.ReadCloser, error)
Pull pulls the incremental difference between two images. Returns an ReaderCloser from where can be read as an oci-archive tarball. The caller is responsible for closing the reader.
func (*Incremental) Push ¶
func (inc *Incremental) Push(ctx context.Context, src, dst string) error
Push pushes the incremental difference stored in the oci-archive tarball pointed by src to the destination registry pointed by to. Be aware that if the remote registry does not contain one or more of the layers not included in the incremental difference the push will fail.
type Option ¶
type Option func(*Incremental)
Option is a functional option for the Incremental type.
func WithAllArchitectures ¶
func WithAllArchitectures() Option
WithAllArchitectures sets the selection to include all the architectures.
func WithBaseAuth ¶
WithBaseAuth sets the authentication for the registry from where we are going to pull the "base" image. If we are comparing images v1 and v2 this is the auth for v1 registry.
func WithFinalAuth ¶
WithFinalAuth sets the authentication for the registry from where we are going to pull the "latest" image. If we are comparing images v1 and v2 this is the auth for v2 registry.
func WithPushAuth ¶
WithPushAuth sets the authentication for the registry where we are going to push the incremental difference. If we have previously compared images v1 and v2 and we are going to push the difference to v3 this is the auth for v3 registry.
func WithReporterWriter ¶
WithReportWriter sets the report writer for the Incremental type. By default the report writer is io.Discard.
func WithTempDir ¶
WithTempDir sets the temporary directory where we are going to store the diff while the user decides what to do with it. By default this is os.TempDir().
type RemoveOnClose ¶
RemoveOnClose is a wrapper around a file that removes the file when closed.
func (RemoveOnClose) Close ¶
func (r RemoveOnClose) Close() error
Close removes the file and closes the underlying file.
type Writer ¶
type Writer struct { types.ImageReference // contains filtered or unexported fields }
Writer provides a tool to copy only the layers that are not already present in a different version of the same image.
func NewWriter ¶
func NewWriter(ctx context.Context, from types.ImageReference, to types.ImageReference, sysctx *types.SystemContext) (*Writer, error)
NewWriter is capable of providing an incremental copy of an image using 'from' as base and storing the result in 'to'.
func (*Writer) NewImageDestination ¶
func (i *Writer) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error)
NewImageDestination returns a handler used to write.