imagestore

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanFn

type CleanFn func()

CleanFn is a function that must be called in order to clean up or free resources in use.

type Registry

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

Registry wraps calls for iteracting with our backend registry. It provides an implementation capable of pushing to and pulling from an image registry. To push an image towards the registry one needs to call Load, to push it to a local tar file a Save call should be made, this strange naming is an attempt to make it similar to the 'docker save/load' commands.

func NewRegistry

func NewRegistry(
	regaddr string,
	repository string,
	sysctx *types.SystemContext,
	polctx *signature.PolicyContext,
) *Registry

NewRegistry creates an entity capable of load objects to or save objects from a backend registry. When calling Load we push an image into the registry, when calling Save we pull the image from the registry and store into a local tar file (format in disk is of type docker-archive, we should migrate this to something else as it does not support manifest lists).

func (*Registry) Load

func (i *Registry) Load(
	ctx context.Context,
	srcref types.ImageReference,
	srcctx *types.SystemContext,
	ns string,
	name string,
) (types.ImageReference, error)

Load pushes an image reference into the backend registry. Uses srcctx (types.SystemContext) when reading image from srcref, so when copying from one remote registry into our mirror registry srcctx must contain all needed authentication information. Images may be stored in mirror.registry.io/namespace/name or mirror.registry.io/repository/namespace-name.

func (*Registry) NewLocalReference

func (i *Registry) NewLocalReference() (types.ImageReference, CleanFn, error)

NewLocalReference returns an image reference pointing to a local tar file. Also returns a clean up function that must be called to free resources.

func (*Registry) Save

Save pulls an image from our mirror registry, stores it in a temporary tar file on disk. Returns an ImageReference pointing to the local tar file and a function the caller needs to call in order to clean up after our mess (properly close tar file and delete it from disk). Returned ref points to a 'docker-archive' tar file.

Jump to

Keyboard shortcuts

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