image

package
v1.5.2-dev Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrImageInUse

func IsErrImageInUse(err error) bool

Types

type ErrImageInUse

type ErrImageInUse struct {
	Msg string
}

func (*ErrImageInUse) Error

func (e *ErrImageInUse) Error() string

type Image

type Image struct {
	// ID is the identifier for this layer.  Usually a SHA
	ID string

	// SelfLink is the URL for this layer.  Filled in by the runtime.
	SelfLink *url.URL

	// ParentLink is the URL for the parent.  It's the VMDK this snapshot inherits from.
	ParentLink *url.URL

	// Store is the URL for the image store the image can be found on.
	Store *url.URL

	// Metadata associated with the image.
	Metadata map[string][]byte

	// Disk is the underlying disk implementation
	Disk *disk.VirtualDisk

	// DatastorePath is the dspath for actually using this image
	// NOTE: this should be replaced by structure accessors for the data and updated storage
	// interfaces that use _one_ variant of url/path for identifying images, volumes and stores.
	// URL was only suggested as an existing structure that could be leveraged when object.DatastorePath
	// was not available. The suggestion seems to have spawned monstruous unnecessary complexity.
	DatastorePath *object.DatastorePath
}

Image is the handle to identify an image layer on the backing store. The URI namespace used to identify the Image in the storage layer has the following path scheme:

`/storage/<image store identifier, usually the vch uuid>/<image id>`

func Parse

func Parse(u *url.URL) (*Image, error)

func (*Image) Copy

func (i *Image) Copy() index.Element

func (*Image) Parent

func (i *Image) Parent() string

Returns a link to the parent. Returns link to self if there is no parent

func (*Image) Self

func (i *Image) Self() string

Returns the Selflink of the image

type ImageStorer

type ImageStorer interface {

	// CreateImageStore creates a location to store images and creates a root
	// disk which serves as the parent of all layers.
	//
	// storeName - The name of the image store to be created.  This must be
	// unique.
	//
	// Returns the URL of the created store
	CreateImageStore(op trace.Operation, storeName string) (*url.URL, error)

	// DeleteImageStore is used to cleanup the image store.  This can only be
	// called once there are no images left in the image store.
	DeleteImageStore(op trace.Operation, storeName string) error

	// Gets the url to an image store via name
	GetImageStore(op trace.Operation, storeName string) (*url.URL, error)

	// ListImageStores lists the available image stores
	ListImageStores(op trace.Operation) ([]*url.URL, error)

	// WriteImage creates a new image layer from the given parent.  Eg
	// parentImage + newLayer = new Image built from parent
	//
	// parent - The parent image to create the new image from.
	// ID - textual ID for the image to be written
	// meta - metadata associated with the image
	// sum - expected sha266 sum of the image content.
	// r - the image tar to be written
	WriteImage(op trace.Operation, parent *Image, ID string, meta map[string][]byte, sum string, r io.Reader) (*Image, error)

	// GetImage queries the image store for the specified image.
	//
	// store - The image store to query name - The name of the image (optional)
	// ID - textual ID for the image to be retrieved
	GetImage(op trace.Operation, store *url.URL, ID string) (*Image, error)

	// ListImages returns a list of Images given a list of image IDs, or all
	// images in the image store if no param is passed.
	ListImages(op trace.Operation, store *url.URL, IDs []string) ([]*Image, error)

	// DeleteImage deletes an image from the image store.  If the image is in
	// use either by way of inheritance or because it's attached to a
	// container, this will return an error.
	DeleteImage(op trace.Operation, image *Image) (*Image, error)

	// GetImageStorageUsage gets the image storage usage from the image store.
	GetImageStorageUsage(op trace.Operation, storeName string) (int64, error)

	// GetImageLayerStorageUsage gets the image layer storage usage from the image store.
	GetImageLayerStorageUsage(op trace.Operation, storeName, ID string) (int64, error)

	storage.Resolver
	storage.Importer
	storage.Exporter
}

ImageStorer is an interface to store images in the Image Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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