graph

package
v1.4.2-0...-31a6e01 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2015 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNameIsNotExist = errors.New("image with specified name does not exist")

ErrNameIsNotExist returned when there is no image with requested name.

Functions

This section is empty.

Types

type Graph

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

A Graph is a store for versioned filesystem images and the relationship between them.

func NewGraph

func NewGraph(root string, driver graphdriver.Driver, uidMaps, gidMaps []idtools.IDMap) (*Graph, error)

NewGraph instantiates a new graph at the given root path in the filesystem. `root` will be created if it doesn't exist.

func (*Graph) ByParent

func (graph *Graph) ByParent() map[string][]*image.Image

ByParent returns a lookup table of images by their parent. If an image of key ID has 3 children images, then the value for key ID will be a list of 3 images. If an image has no children, it will not have an entry in the table.

func (*Graph) CheckDepth

func (graph *Graph) CheckDepth(img *image.Image) error

CheckDepth returns an error if the depth of an image, as returned by ImageDepth, is too large to support creating a container from it on this daemon.

func (*Graph) Create

func (graph *Graph) Create(layerData io.Reader, containerID, containerImage, comment, author string, containerConfig, config *runconfig.Config) (*image.Image, error)

Create creates a new image and registers it in the graph.

func (*Graph) Delete

func (graph *Graph) Delete(name string) error

Delete atomically removes an image from the graph.

func (*Graph) Exists

func (graph *Graph) Exists(id string) bool

Exists returns true if an image is registered at the given id. If the image doesn't exist or if an error is encountered, false is returned.

func (*Graph) Get

func (graph *Graph) Get(name string) (*image.Image, error)

Get returns the image with the given id, or an error if the image doesn't exist.

func (*Graph) GetParent

func (graph *Graph) GetParent(img *image.Image) (*image.Image, error)

GetParent returns the parent image for the specified image.

func (*Graph) HasChildren

func (graph *Graph) HasChildren(imgID string) bool

HasChildren returns whether the given image has any child images.

func (*Graph) IsHeld

func (graph *Graph) IsHeld(layerID string) bool

IsHeld returns whether the given layerID is being used by an ongoing pull or build.

func (*Graph) IsNotExist

func (graph *Graph) IsNotExist(err error, id string) bool

IsNotExist detects whether an image exists by parsing the incoming error message.

func (*Graph) Map

func (graph *Graph) Map() map[string]*image.Image

Map returns a list of all images in the graph, addressable by ID.

func (*Graph) Register

func (graph *Graph) Register(im image.Descriptor, layerData io.Reader) (err error)

Register imports a pre-existing image into the graph. Returns nil if the image is already registered.

func (*Graph) Release

func (graph *Graph) Release(sessionID string, layerIDs ...string)

Release removes the referenced image ID from the provided set of layers.

func (*Graph) Retain

func (graph *Graph) Retain(sessionID string, layerIDs ...string)

Retain keeps the images and layers that are in the pulling chain so that they are not deleted. If not retained, they may be deleted by rmi.

type ImagePullConfig

type ImagePullConfig struct {
	// MetaHeaders stores HTTP headers with metadata about the image
	// (DockerHeaders with prefix X-Meta- in the request).
	MetaHeaders map[string][]string
	// AuthConfig holds authentication credentials for authenticating with
	// the registry.
	AuthConfig *cliconfig.AuthConfig
	// OutStream is the output writer for showing the status of the pull
	// operation.
	OutStream io.Writer
}

ImagePullConfig stores pull configuration.

type ImagePushConfig

type ImagePushConfig struct {
	// MetaHeaders store HTTP headers with metadata about the image
	// (DockerHeaders with prefix X-Meta- in the request).
	MetaHeaders map[string][]string
	// AuthConfig holds authentication credentials for authenticating with
	// the registry.
	AuthConfig *cliconfig.AuthConfig
	// Tag is the specific variant of the image to be pushed.
	// If no tag is provided, all tags will be pushed.
	Tag string
	// OutStream is the output writer for showing the status of the push
	// operation.
	OutStream io.Writer
}

ImagePushConfig stores push configuration.

type TagStore

type TagStore struct {

	// Repositories is a map of repositories, indexed by name.
	Repositories map[string]repository

	sync.Mutex
	// contains filtered or unexported fields
}

TagStore manages repositories. It encompasses the Graph used for versioned storage, as well as various services involved in pushing and pulling repositories.

func NewTagStore

func NewTagStore(path string, cfg *TagStoreConfig) (*TagStore, error)

NewTagStore creates a new TagStore at specified path, using the parameters and services provided in cfg.

func (*TagStore) ByID

func (store *TagStore) ByID() map[string][]string

ByID returns a reverse-lookup table of all the names which refer to each image - e.g. {"43b5f19b10584": {"base:latest", "base:v1"}}

func (*TagStore) Delete

func (store *TagStore) Delete(repoName, ref string) (bool, error)

Delete deletes a repository or a specific tag. If ref is empty, the entire repository named repoName will be deleted; otherwise only the tag named by ref will be deleted.

func (*TagStore) GetID

func (store *TagStore) GetID(name string) (string, error)

GetID returns ID for image name.

func (*TagStore) HasReferences

func (store *TagStore) HasReferences(img *image.Image) bool

HasReferences returns whether or not the given image is referenced in one or more repositories.

func (*TagStore) History

func (s *TagStore) History(name string) ([]*types.ImageHistory, error)

History returns a slice of ImageHistory structures for the specified image name by walking the image lineage.

func (*TagStore) ImageExport

func (s *TagStore) ImageExport(names []string, outStream io.Writer) error

ImageExport exports list of images to a output stream specified in the config. The exported images are archived into a tar when written to the output stream. All images with the given tag and all versions containing the same tag are exported. names is the set of tags to export, and outStream is the writer which the images are written to.

func (*TagStore) Images

func (s *TagStore) Images(filterArgs, filter string, all bool) ([]*types.Image, error)

Images returns a filtered list of images. filterArgs is a JSON-encoded set of filter arguments which will be interpreted by pkg/parsers/filters. filter is a shell glob string applied to repository names. The argument named all controls whether all images in the graph are filtered, or just the heads.

func (*TagStore) Import

func (s *TagStore) Import(src string, repo string, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, containerConfig *runconfig.Config) error

Import imports an image, getting the archived layer data either from inConfig (if src is "-"), or from a URI specified in src. Progress output is written to outStream. Repository and tag names can optionally be given in the repo and tag arguments, respectively.

func (*TagStore) Load

func (s *TagStore) Load(inTar io.ReadCloser, outStream io.Writer) error

Load uploads a set of images into the repository. This is the complementary of ImageExport. The input stream is an uncompressed tar ball containing images and metadata.

func (*TagStore) Lookup

func (s *TagStore) Lookup(name string) (*types.ImageInspect, error)

Lookup looks up an image by name in a TagStore and returns it as an ImageInspect structure.

func (*TagStore) LookupImage

func (store *TagStore) LookupImage(name string) (*image.Image, error)

LookupImage returns pointer to an Image struct corresponding to the given name. The name can include an optional tag; otherwise the default tag will be used.

func (*TagStore) Pull

func (s *TagStore) Pull(image string, tag string, imagePullConfig *ImagePullConfig) error

Pull initiates a pull operation. image is the repository name to pull, and tag may be either empty, or indicate a specific tag to pull.

func (*TagStore) Push

func (s *TagStore) Push(localName string, imagePushConfig *ImagePushConfig) error

Push initiates a push operation on the repository named localName.

func (*TagStore) Tag

func (store *TagStore) Tag(repoName, tag, imageName string, force bool) error

Tag creates a tag in the repository reponame, pointing to the image named imageName. If force is true, an existing tag with the same name may be overwritten.

type TagStoreConfig

type TagStoreConfig struct {
	// Graph is the versioned image store
	Graph *Graph
	// Key is the private key to use for signing manifests.
	Key libtrust.PrivateKey
	// Registry is the registry service to use for TLS configuration and
	// endpoint lookup.
	Registry *registry.Service
	// Events is the events service to use for logging.
	Events *events.Events
}

TagStoreConfig provides parameters for a new TagStore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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