graph

package
v1.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2015 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULTTAG = "latest"

Variables

This section is empty.

Functions

func SetupInitLayer

func SetupInitLayer(initLayer string) error

setupInitLayer populates a directory with mountpoints suitable for bind-mounting dockerinit into the container. The mountpoint is simply an empty file at /.dockerinit

This extra layer is used by all containers as the top-most ro layer. It protects the container from unwanted side-effects on the rw layer.

func ValidateTagName added in v1.3.0

func ValidateTagName(name string) error

Validate the name of a tag

func WriteStatus added in v1.3.0

func WriteStatus(requestedTag string, out io.Writer, sf *utils.StreamFormatter, layers_downloaded bool)

Types

type Graph

type Graph struct {
	Root string
	// 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) (*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, error)

ByParent returns a lookup table of images by their parent. If an image of id 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) Create

func (graph *Graph) Create(layerData archive.ArchiveReader, 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) Driver

func (graph *Graph) Driver() graphdriver.Driver

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) Heads

func (graph *Graph) Heads() (map[string]*image.Image, error)

Heads returns all heads in the graph, keyed by id. A head is an image which is not the parent of another image in the graph.

func (*Graph) ImageRoot

func (graph *Graph) ImageRoot(id string) string

func (*Graph) IsNotExist

func (graph *Graph) IsNotExist(err error) bool

FIXME: Implement error subclass instead of looking at the error text Note: This is the way golang implements os.IsNotExists on Plan9

func (*Graph) Map

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

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

func (*Graph) Mktemp

func (graph *Graph) Mktemp(id string) (string, error)

Mktemp creates a temporary sub-directory inside the graph's filesystem.

func (*Graph) Register

func (graph *Graph) Register(img *image.Image, layerData archive.ArchiveReader) (err error)

Register imports a pre-existing image into the graph.

func (*Graph) TempLayerArchive

func (graph *Graph) TempLayerArchive(id string, sf *utils.StreamFormatter, output io.Writer) (*archive.TempArchive, error)

TempLayerArchive creates a temporary archive of the given image's filesystem layer.

The archive is stored on disk and will be automatically deleted as soon as has been read.
If output is not nil, a human-readable progress bar will be written to it.
FIXME: does this belong in Graph? How about MktempFile, let the caller use it for archives?

type Repository

type Repository map[string]string

func (Repository) Contains added in v1.3.0

func (r Repository) Contains(u Repository) bool

return true if the contents of u Repository, are wholly contained in r Repository

func (Repository) Update added in v1.3.0

func (r Repository) Update(u Repository)

update Repository mapping with content of u

type TagStore

type TagStore struct {
	Repositories map[string]Repository

	sync.Mutex
	// contains filtered or unexported fields
}

func NewTagStore

func NewTagStore(path string, graph *Graph, key libtrust.PrivateKey) (*TagStore, error)

func (*TagStore) ByID

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

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

func (*TagStore) CmdGet added in v0.12.0

func (s *TagStore) CmdGet(job *engine.Job) engine.Status

CmdGet returns information about an image. If the image doesn't exist, an empty object is returned, to allow checking for an image's existence.

func (*TagStore) CmdHistory added in v1.2.0

func (s *TagStore) CmdHistory(job *engine.Job) engine.Status

func (*TagStore) CmdImageExport added in v1.2.0

func (s *TagStore) CmdImageExport(job *engine.Job) engine.Status

CmdImageExport exports all images with the given tag. All versions containing the same tag are exported. The resulting output is an uncompressed tar ball. name is the set of tags to export. out is the writer where the images are written to.

func (*TagStore) CmdImages added in v1.2.0

func (s *TagStore) CmdImages(job *engine.Job) engine.Status

func (*TagStore) CmdImport added in v1.2.0

func (s *TagStore) CmdImport(job *engine.Job) engine.Status

func (*TagStore) CmdLoad added in v1.2.0

func (s *TagStore) CmdLoad(job *engine.Job) engine.Status

Loads 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) CmdLookup added in v0.12.0

func (s *TagStore) CmdLookup(job *engine.Job) engine.Status

CmdLookup return an image encoded in JSON

func (*TagStore) CmdManifest

func (s *TagStore) CmdManifest(job *engine.Job) engine.Status

func (*TagStore) CmdPull added in v1.2.0

func (s *TagStore) CmdPull(job *engine.Job) engine.Status

func (*TagStore) CmdPush added in v1.2.0

func (s *TagStore) CmdPush(job *engine.Job) engine.Status

FIXME: Allow to interrupt current push when new push of same image is done.

func (*TagStore) CmdSet added in v0.12.0

func (s *TagStore) CmdSet(job *engine.Job) engine.Status

CmdSet stores a new image in the graph. Images are stored in the graph using 4 elements:

  • A user-defined ID
  • A collection of metadata describing the image
  • A directory tree stored as a tar archive (also called the "layer")
  • A reference to a "parent" ID on top of which the layer should be applied

NOTE: even though the parent ID is only useful in relation to the layer and how to apply it (ie you could represent the full directory tree as 'parent_layer + layer', it is treated as a top-level property of the image. This is an artifact of early design and should probably be cleaned up in the future to simplify the design.

Syntax: image_set ID Input:

  • Layer content must be streamed in tar format on stdin. An empty input is valid and represents a nil layer.

  • Image metadata must be passed in the command environment. 'json': a json-encoded object with all image metadata. It will be stored as-is, without any encoding/decoding artifacts. That is a requirement of the current registry client implementation, because a re-encoded json might invalidate the image checksum at the next upload, even with functionaly identical content.

func (*TagStore) CmdTag added in v0.12.0

func (s *TagStore) CmdTag(job *engine.Job) engine.Status

CmdTag assigns a new name and tag to an existing image. If the tag already exists, it is changed and the image previously referenced by the tag loses that reference. This may cause the old image to be garbage-collected if its reference count reaches zero.

Syntax: image_tag NEWNAME OLDNAME Example: image_tag shykes/myapp:latest shykes/myapp:1.42.0

func (*TagStore) CmdTagLegacy added in v1.2.0

func (s *TagStore) CmdTagLegacy(job *engine.Job) engine.Status

FIXME: merge into CmdTag above, and merge "image_tag" and "tag" into a single job.

func (*TagStore) CmdTarLayer added in v0.12.0

func (s *TagStore) CmdTarLayer(job *engine.Job) engine.Status

CmdTarLayer return the tarLayer of the image

func (*TagStore) CmdViz added in v1.2.0

func (s *TagStore) CmdViz(job *engine.Job) engine.Status

func (*TagStore) Delete

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

func (*TagStore) DeleteAll

func (store *TagStore) DeleteAll(id string) error

func (*TagStore) Get

func (store *TagStore) Get(repoName string) (Repository, error)

func (*TagStore) GetImage

func (store *TagStore) GetImage(repoName, tagOrID string) (*image.Image, error)

func (*TagStore) GetRepoRefs added in v0.12.0

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

func (*TagStore) ImageName

func (store *TagStore) ImageName(id string) string

func (*TagStore) Install added in v0.12.0

func (s *TagStore) Install(eng *engine.Engine) error

func (*TagStore) LookupImage

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

func (*TagStore) Set

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

Jump to

Keyboard shortcuts

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