cache

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDoesNotExist returned if a reference is not found in the
	// store.
	ErrDoesNotExist = errors.New("reference does not exist")
)

Functions

func InitializeImageCache

func InitializeImageCache(client *client.PortLayer) error

InitializeImageCache will create a new image cache or rehydrate an existing image cache from the portlayer k/v store

func NewRepositoryCache

func NewRepositoryCache(client *client.PortLayer) error

NewRespositoryCache will create a new repoCache or rehydrate an existing repoCache from the portlayer k/v store

Types

type Association

type Association struct {
	Ref     reference.Named
	ImageID string
}

An Association is a tuple associating a reference with an image ID.

type CCache

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

Tracks our container info from calls

func ContainerCache

func ContainerCache() *CCache

ContainerCache returns a reference to the container cache

func (*CCache) AddContainer

func (cc *CCache) AddContainer(container *container.VicContainer)

func (*CCache) AddExecToContainer

func (cc *CCache) AddExecToContainer(container *container.VicContainer, eid string)

func (*CCache) DeleteContainer

func (cc *CCache) DeleteContainer(nameOrID string)

func (*CCache) GetContainer

func (cc *CCache) GetContainer(nameOrID string) *container.VicContainer

func (*CCache) GetContainerByName

func (cc *CCache) GetContainerByName(nameOnly string) *container.VicContainer

GetContainerByName returns a container whose name "exactly" matches nameOnly

func (*CCache) GetContainerFromExec

func (cc *CCache) GetContainerFromExec(eid string) *container.VicContainer

func (*CCache) ReleaseName

func (cc *CCache) ReleaseName(name string)

ReleaseName is used during a container rename operation to allow concurrent container create/rename operations to use the name. It is also used during a failed create operation to allow subsequent create operations to use that name.

func (*CCache) ReserveName

func (cc *CCache) ReserveName(container *container.VicContainer, name string) error

ReserveName is used during a container create/rename operation to prevent concurrent container create/rename operations from grabbing the new name.

func (*CCache) UpdateContainerName

func (cc *CCache) UpdateContainerName(oldName, newName string) error

UpdateContainerName assumes that the newName is already reserved by ReserveName so no need to check the existence of a container with the new name.

type ICache

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

ICache is an in-memory cache of image metadata. It is refreshed at startup by a call to the portlayer. It is updated when new images are pulled or images are deleted.

func ImageCache

func ImageCache() *ICache

ImageCache returns a reference to the image cache

func (*ICache) Add

func (ic *ICache) Add(imageConfig *metadata.ImageConfig) error

Add adds an image to the image cache

func (*ICache) Get

func (ic *ICache) Get(idOrRef string) (*metadata.ImageConfig, error)

Get parses input to retrieve a cached image

func (*ICache) GetImages

func (ic *ICache) GetImages() []*metadata.ImageConfig

GetImages returns a slice containing metadata for all cached images

func (*ICache) IsImageID

func (ic *ICache) IsImageID(id string) bool

IsImageID will check that a full or partial imageID exists in the cache

func (*ICache) RemoveImageByConfig

func (ic *ICache) RemoveImageByConfig(imageConfig *metadata.ImageConfig)

RemoveImageByConfig removes image from the cache.

func (*ICache) Save

func (ic *ICache) Save() error

Save will persist the image cache to the portlayer k/v store

type Repo

type Repo interface {
	References(imageID string) []reference.Named
	ReferencesByName(ref reference.Named) []Association
	Delete(ref reference.Named, save bool) (bool, error)
	Get(ref reference.Named) (string, error)

	Save() error
	GetImageID(layerID string) string
	Tags(imageID string) []string
	Digests(imageID string) []string
	AddReference(ref reference.Named, imageID string, force bool, layerID string, save bool) error

	// Remove will remove from the cache and returns the
	// stringified Named if successful -- save bool instructs
	// func to persist to portlayer k/v or not
	Remove(ref string, save bool) (string, error)
}

Repo provides the set of methods which can operate on a tag store.

func RepositoryCache

func RepositoryCache() Repo

RepositoryCache returns a ref to the repoCache interface

Jump to

Keyboard shortcuts

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