cache

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCorruptImageStore = errors.New("Corrupt image store")

Functions

This section is empty.

Types

type NameLookupCache

type NameLookupCache struct {

	// The image store implementation.  This mutates the actual disk images.
	DataStore image.ImageStorer
	// contains filtered or unexported fields
}

NameLookupCache the global view of all of the image stores. To avoid unnecessary lookups, the image cache keeps an in memory map of the store URI to the map of images on disk.

func NewLookupCache

func NewLookupCache(ds image.ImageStorer) *NameLookupCache

func (*NameLookupCache) CreateImageStore

func (c *NameLookupCache) CreateImageStore(op trace.Operation, storeName string) (*url.URL, error)

func (*NameLookupCache) DeleteBranch

func (c *NameLookupCache) DeleteBranch(op trace.Operation, img *image.Image, keepNodes []*url.URL) ([]*image.Image, error)

DeleteBranch deletes a branch of images, starting from nodeID, up to the first node with degree greater than 1. keepNodes is the array of images to keep (and their branches).

func (*NameLookupCache) DeleteImage

func (c *NameLookupCache) DeleteImage(op trace.Operation, img *image.Image) (*image.Image, error)

DeleteImage deletes an image from the image store. If it is in use or is being inheritted from, then this will return an error.

func (*NameLookupCache) Export

func (c *NameLookupCache) Export(op trace.Operation, store *url.URL, id, ancestor string, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

func (*NameLookupCache) GetImage

func (c *NameLookupCache) GetImage(op trace.Operation, store *url.URL, ID string) (*image.Image, error)

GetImage gets the specified image from the given store by retreiving it from the cache.

func (*NameLookupCache) GetImageStore

func (c *NameLookupCache) GetImageStore(op trace.Operation, storeName string) (*url.URL, error)

GetImageStore checks to see if a named image store exists and returns the URL to it if so or error.

func (*NameLookupCache) ImageStorageUsage

func (c *NameLookupCache) ImageStorageUsage() int64

func (*NameLookupCache) Import

func (c *NameLookupCache) Import(op trace.Operation, store *url.URL, diskID string, spec *archive.FilterSpec, tarStream io.ReadCloser) error

func (*NameLookupCache) ListImageStores

func (c *NameLookupCache) ListImageStores(op trace.Operation) ([]*url.URL, error)

ListImageStores returns a list of strings representing all existing image stores

func (*NameLookupCache) ListImages

func (c *NameLookupCache) ListImages(op trace.Operation, store *url.URL, IDs []string) ([]*image.Image, error)

ListImages returns a list of Images for a list of IDs, or all if no IDs are passed

func (*NameLookupCache) NewDataSource

func (c *NameLookupCache) NewDataSource(op trace.Operation, id string) (storage.DataSource, error)

func (*NameLookupCache) Owners

func (c *NameLookupCache) Owners(op trace.Operation, url *url.URL, filter func(vm *mo.VirtualMachine) bool) ([]*vm.VirtualMachine, error)

func (*NameLookupCache) SetImageStorageUsage

func (c *NameLookupCache) SetImageStorageUsage(value int64)

func (*NameLookupCache) URL

func (c *NameLookupCache) URL(op trace.Operation, id string) (*url.URL, error)

func (*NameLookupCache) UpdateStorageUsage

func (c *NameLookupCache) UpdateStorageUsage(op trace.Operation, store *url.URL, id string) error

func (*NameLookupCache) WriteImage

func (c *NameLookupCache) WriteImage(op trace.Operation, parent *image.Image, ID string, meta map[string][]byte, sum string, r io.Reader) (*image.Image, error)

Jump to

Keyboard shortcuts

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