store

package
v1.4.2-0...-b708a22 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInUse

func IsInUse(err error) bool

IsInUse returns a boolean indicating whether the error indicates that a volume is in use

func IsNotExist

func IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error indicates that the volume does not exist

Types

type OpErr

type OpErr struct {
	// Err is the error that occurred during the operation.
	Err error
	// Op is the operation which caused the error, such as "create", or "list".
	Op string
	// Name is the name of the resource being requested for this op, typically the volume name or the driver name.
	Name string
}

OpErr is the error type returned by functions in the store package. It describes the operation, volume name, and error.

func (*OpErr) Error

func (e *OpErr) Error() string

Error satisfies the built-in error interface type.

type VolumeStore

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

VolumeStore is a struct that stores the list of volumes available and keeps track of their usage counts

func New

func New() *VolumeStore

New initializes a VolumeStore to keep reference counting of volumes in the system.

func (*VolumeStore) AddAll

func (s *VolumeStore) AddAll(vols []volume.Volume)

AddAll adds a list of volumes to the store

func (*VolumeStore) Count

func (s *VolumeStore) Count(v volume.Volume) uint

Count returns the usage count of the passed in volume

func (*VolumeStore) Create

func (s *VolumeStore) Create(name, driverName string, opts map[string]string) (volume.Volume, error)

Create tries to find an existing volume with the given name or create a new one from the passed in driver

func (*VolumeStore) Decrement

func (s *VolumeStore) Decrement(v volume.Volume)

Decrement decrements the usage count of the passed in volume by 1

func (*VolumeStore) FilterByDriver

func (s *VolumeStore) FilterByDriver(name string) []volume.Volume

FilterByDriver returns the available volumes filtered by driver name

func (*VolumeStore) Get

func (s *VolumeStore) Get(name string) (volume.Volume, error)

Get looks if a volume with the given name exists and returns it if so

func (*VolumeStore) Increment

func (s *VolumeStore) Increment(v volume.Volume)

Increment increments the usage count of the passed in volume by 1

func (*VolumeStore) List

func (s *VolumeStore) List() []volume.Volume

List returns all the available volumes

func (*VolumeStore) Remove

func (s *VolumeStore) Remove(v volume.Volume) error

Remove removes the requested volume. A volume is not removed if the usage count is > 0

Jump to

Keyboard shortcuts

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