layers

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2017 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Docker

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

Docker needs a documetnation

func NewDocker

func NewDocker(ctx context.Context, tty bool, logger *logger.Logger) (*Docker, error)

NewDocker needs a documetnation

func (*Docker) AddImage

func (d *Docker) AddImage(image string) error

AddImage adds layers to the layer list from a provided image, in order of appearance. Any existing layers are skipped over, removing them from the list.

func (*Docker) Fetch

func (d *Docker) Fetch(config *config.Config, name string) (string, error)

Fetch retrieves a docker image, overwrites the container configuration, and returns its id.

func (*Docker) Lookup

func (d *Docker) Lookup(config *config.Config, name string) (string, error)

Lookup an image by name, returning the id.

func (*Docker) MakeImage

func (d *Docker) MakeImage(config *config.Config) (string, error)

MakeImage makes the final image, skipping any layers as necessary. The layers must be pre-recorded within the executor. Note that if you have no layers to skip, this operation will need to do nothing, so it will do nothing.

It returns an error condition, if any.

func (*Docker) SetContext

func (d *Docker) SetContext(ctx context.Context)

SetContext sets the context for subsequent calls.

func (*Docker) SetLayers

func (d *Docker) SetLayers(layers []string)

SetLayers sets the layers.

func (*Docker) SetSkipLayers

func (d *Docker) SetSkipLayers(ok bool)

SetSkipLayers toggles whether or not to skip layers that are being built next. Toggle again to re-enable layer recording. The final image will not contain the skipped layers.

type DockerImage

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

DockerImage is the Image interface applied to docker.

func NewDockerImage

func NewDockerImage(context context.Context, imageConfig *ImageConfig) (*DockerImage, error)

NewDockerImage constructs a new DockerImage

func (*DockerImage) CheckCache

func (d *DockerImage) CheckCache(cacheKey string) (bool, error)

CheckCache consults the cache and returns true or false depending on whether there was a match. If there was an error consulting the cache, it will be returned as the second argument.

func (*DockerImage) Flatten

func (d *DockerImage) Flatten(id string, size int64, tw io.Reader) error

Flatten copies a tarred up series of files (passed in through the io.Reader handle) to the image where they are untarred.

func (*DockerImage) GetCache

func (d *DockerImage) GetCache() bool

GetCache gets the current value of whether or not to use the cache

func (*DockerImage) ImageID

func (d *DockerImage) ImageID() string

ImageID returns the image identifier of the most recent layer.

func (*DockerImage) Save

func (d *DockerImage) Save(filename, kind, tag string) error

Save saves an image to the provided filename.

func (*DockerImage) SetContext

func (d *DockerImage) SetContext(ctx context.Context)

SetContext sets the current context for execution

func (*DockerImage) Tag

func (d *DockerImage) Tag(tag string) error

Tag an image with the provided string.

func (*DockerImage) UseCache

func (d *DockerImage) UseCache(arg bool)

UseCache determines if the cache should be considered or not.

type Image

type Image interface {
	// SetContext sets the context for upcoming operations.
	SetContext(context.Context)

	// Flatten copies a tarred up series of files (passed in through the
	// io.Reader handle) to the image where they are untarred. The first argument
	// is the parent image to use.
	Flatten(string, int64, io.Reader) error

	// Tag the current layer. Takes a tag name as argument.
	Tag(string) error

	// CheckCache consults the cache to see if there are any items which fit it.
	CheckCache(string) (bool, error)

	// UseCache determines if the cache should be considered or not.
	UseCache(bool)

	// GetCache gets the current value of whether or not to use the cache
	GetCache() bool

	// ImageID returns the image identifier of the most recent layer.
	ImageID() string

	// Save saves an image to the provided filename.
	Save(string, string, string) error
}

Image needs a description

type ImageConfig

type ImageConfig struct {
	Layers   Layers
	UseCache bool
	Config   *config.Config
	Logger   *logger.Logger
}

ImageConfig sets the properties used to construct an

type Layers

type Layers interface {
	// Pull an image. Takes a name and returns an image ID+error.
	Fetch(*config.Config, string) (string, error)

	// SetLayers sets the layers.
	SetLayers([]string)

	// AddImage adds layers to the layer list from a provided image, in order of
	// appearance. Any existing layers are skipped over, removing them from the list.
	AddImage(string) error

	// SetSkipLayers toggles whether or not to skip layers that are being built
	// next. Toggle again to re-enable layer recording. The final image will not
	// contain the skipped layers.
	SetSkipLayers(bool)

	// MakeImage makes the final image, skipping any layers as necessary. The
	// layers must be pre-recorded within the executor.
	// It returns an error condition, if any.
	MakeImage(config *config.Config) (string, error)

	// Look up an image identifier.
	Lookup(*config.Config, string) (string, error)

	// SetContext sets the context for subsequent calls.
	SetContext(ctx context.Context)
}

Layers needs a description

Jump to

Keyboard shortcuts

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