Documentation
¶
Overview ¶
Package volumestore allows manipulating containers' volumes. All methods are safe to use concurrently (and perform atomic writes), except CreateWithoutLock, which is specifically meant to be used multiple times, inside a Lock-ed section.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrVolumeStore = errors.New("volume-store error")
ErrVolumeStore will wrap all errors here
Functions ¶
This section is empty.
Types ¶
type VolumeStore ¶
type VolumeStore interface {
// Exists checks if a given volume exists
Exists(name string) (bool, error)
// Get returns an existing volume
Get(name string, size bool) (*native.Volume, error)
// Create will either return an existing volume, or create a new one
// NOTE that different labels will NOT create a new volume if there is one by that name already,
// but instead return the existing one with the (possibly different) labels
Create(name string, labels []string) (vol *native.Volume, err error)
// List returns all existing volumes.
// Note that list is expensive as it reads all volumes individual info
List(size bool) (map[string]native.Volume, error)
// Remove one of more volumes
Remove(generator func() ([]string, []error, error)) (removed []string, warns []error, err error)
// Prune will call a filtering function expected to return the volumes name to delete
Prune(filter func(volumes []*native.Volume) ([]string, error)) (err error)
// Count returns the number of volumes
Count() (count int, err error)
// Lock: see store implementation
Lock() error
// CreateWithoutLock will create a volume (or return an existing one).
// This method does NOT lock (unlike Create).
// It is meant to be used between `Lock` and `Release`, and is specifically useful when multiple different volume
// creation will have to happen in different method calls (eg: container create).
CreateWithoutLock(name string, labels []string) (*native.Volume, error)
// Release: see store implementation
Release() error
}
func New ¶
func New(dataStore, namespace string) (volStore VolumeStore, err error)
New returns a VolumeStore
Click to show internal directories.
Click to hide internal directories.