image

package
v0.0.0-...-b9be53e Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2037 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package image consolidates knowledge about various container image formats (as opposed to image storage mechanisms, which are handled by types.ImageSource) and exposes all of them using an unified interface.

Index

Constants

View Source
const GzippedEmptyLayerDigest = digest.Digest("sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4")

GzippedEmptyLayerDigest is a digest of GzippedEmptyLayer

Variables

View Source
var GzippedEmptyLayer = []byte{
	31, 139, 8, 0, 0, 9, 110, 136, 0, 255, 98, 24, 5, 163, 96, 20, 140, 88,
	0, 8, 0, 0, 255, 255, 46, 175, 181, 239, 0, 4, 0, 0,
}

GzippedEmptyLayer is a gzip-compressed version of an empty tar file (1024 NULL bytes) This comes from github.com/docker/distribution/manifest/schema1/config_builder.go; there is a non-zero embedded timestamp; we could zero that, but that would just waste storage space in registries, so let’s use the same values.

Functions

func ChooseManifestInstanceFromManifestList

func ChooseManifestInstanceFromManifestList(ctx context.Context, sys *types.SystemContext, src types.UnparsedImage) (digest.Digest, error)

ChooseManifestInstanceFromManifestList returns a digest of a manifest appropriate for the current system from the manifest available from src.

func FromSource

FromSource returns a types.ImageCloser implementation for the default instance of source. If source is a manifest list, .Manifest() still returns the manifest list, but other methods transparently return data from an appropriate image instance.

The caller must call .Close() on the returned ImageCloser.

FromSource “takes ownership” of the input ImageSource and will call src.Close() when the image is closed. (This does not prevent callers from using both the Image and ImageSource objects simultaneously, but it means that they only need to the Image.)

NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource, verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage instead of calling this function.

func FromUnparsedImage

func FromUnparsedImage(ctx context.Context, sys *types.SystemContext, unparsed *UnparsedImage) (types.Image, error)

FromUnparsedImage returns a types.Image implementation for unparsed. If unparsed represents a manifest list, .Manifest() still returns the manifest list, but other methods transparently return data from an appropriate single image.

The Image must not be used after the underlying ImageSource is Close()d.

Types

type UnparsedImage

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

UnparsedImage implements types.UnparsedImage . An UnparsedImage is a pair of (ImageSource, instance digest); it can represent either a manifest list or a single image instance.

func UnparsedInstance

func UnparsedInstance(src types.ImageSource, instanceDigest *digest.Digest) *UnparsedImage

UnparsedInstance returns a types.UnparsedImage implementation for (source, instanceDigest). If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve (when the primary manifest is a manifest list).

The UnparsedImage must not be used after the underlying ImageSource is Close()d.

func (*UnparsedImage) Manifest

func (i *UnparsedImage) Manifest(ctx context.Context) ([]byte, string, error)

Manifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.

func (*UnparsedImage) Reference

func (i *UnparsedImage) Reference() types.ImageReference

Reference returns the reference used to set up this source, _as specified by the user_ (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.

func (*UnparsedImage) Signatures

func (i *UnparsedImage) Signatures(ctx context.Context) ([][]byte, error)

Signatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.

Jump to

Keyboard shortcuts

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