incremental

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

func WithBaseAuth(user, pass string) Option

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

func WithFinalAuth(user, pass string) Option

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

func WithPushAuth(user, pass string) Option

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

func WithReporterWriter(reporter io.Writer) Option

WithReportWriter sets the report writer for the Incremental type. By default the report writer is io.Discard.

func WithTempDir

func WithTempDir(dir string) Option

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

type RemoveOnClose struct {
	*os.File
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

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