docker: github.com/narqo/docker/graph Index | Files | Directories

package graph

import "github.com/narqo/docker/graph"

Index

Package Files

export.go graph.go history.go import.go list.go load.go pull.go pull_v1.go pull_v2.go push.go push_v1.go push_v2.go registry.go service.go tags.go

Variables

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

ErrNameIsNotExist returned when there is no image with requested name.

type Graph Uses

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

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

func NewGraph Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Delete atomically removes an image from the graph.

func (*Graph) Exists Uses

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 Uses

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 Uses

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

GetParent returns the parent image for the specified image.

func (*Graph) HasChildren Uses

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

HasChildren returns whether the given image has any child images.

func (*Graph) IsHeld Uses

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 Uses

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

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

func (*Graph) Map Uses

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

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

func (*Graph) Register Uses

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 Uses

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

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

func (*Graph) Retain Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

GetID returns ID for image name.

func (*TagStore) HasReferences Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Push initiates a push operation on the repository named localName.

func (*TagStore) Tag Uses

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 Uses

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

PathSynopsis
tags

Package graph imports 54 packages (graph). Updated 2017-07-04. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).