util

package
v0.16.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RegistryDefaultPathPrefix contains a per-registry listing of default prefixes
	// to prepend to image names that only contain a single path component.
	RegistryDefaultPathPrefix = map[string]string{
		"index.docker.io": "library",
		"docker.io":       "library",
	}
	// Transports contains the possible transports used for images
	Transports = map[string]string{
		dockerarchive.Transport.Name(): "",
		ociarchive.Transport.Name():    "",
		directory.Transport.Name():     "",
		tarball.Transport.Name():       "",
	}
	// DockerArchive is the transport we prepend to an image name
	// when saving to docker-archive
	DockerArchive = dockerarchive.Transport.Name()
	// OCIArchive is the transport we prepend to an image name
	// when saving to oci-archive
	OCIArchive = ociarchive.Transport.Name()
	// DirTransport is the transport for pushing and pulling
	// images to and from a directory
	DirTransport = directory.Transport.Name()
	// TarballTransport is the transport for importing a tar archive
	// and creating a filesystem image
	TarballTransport = tarball.Transport.Name()
)

Functions

func AddImageNames

func AddImageNames(store storage.Store, image *storage.Image, addNames []string) error

AddImageNames adds the specified names to the specified image.

func ExpandNames

func ExpandNames(names []string) ([]string, error)

ExpandNames takes unqualified names, parses them as image names, and returns the fully expanded result, including a tag. Names which don't include a registry name will be marked for the most-preferred registry (i.e., the first one in our configuration).

func FindImage

func FindImage(store storage.Store, image string) (*storage.Image, error)

FindImage locates the locally-stored image which corresponds to a given name.

func GetFailureCause

func GetFailureCause(err, defaultError error) error

GetFailureCause checks the type of the error "err" and returns a new error message that reflects the reason of the failure. In case err type is not a familiar one the error "defaultError" is returned.

func GetLocalTime

func GetLocalTime(localTime time.Time) time.Time

GetLocalTime discover the UTC offset and then add that to the passed in time to arrive at the local time.

func ResolveName

func ResolveName(name string, firstRegistry string, sc *types.SystemContext, store storage.Store) []string

ResolveName checks if name is a valid image name, and if that name doesn't include a domain portion, returns a list of the names which it might correspond to in the registries.

Types

This section is empty.

Jump to

Keyboard shortcuts

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