Documentation ¶
Index ¶
- func IsInUse(err error) bool
- func IsNameConflict(err error) bool
- func IsNotExist(err error) bool
- type OpErr
- type VolumeStore
- func (s *VolumeStore) Create(name, driverName string, opts, labels map[string]string) (volume.Volume, error)
- func (s *VolumeStore) CreateWithRef(name, driverName, ref string, opts, labels map[string]string) (volume.Volume, error)
- func (s *VolumeStore) Dereference(v volume.Volume, ref string)
- func (s *VolumeStore) FilterByDriver(name string) ([]volume.Volume, error)
- func (s *VolumeStore) FilterByUsed(vols []volume.Volume, used bool) []volume.Volume
- func (s *VolumeStore) Get(name string) (volume.Volume, error)
- func (s *VolumeStore) GetWithRef(name, driverName, ref string) (volume.Volume, error)
- func (s *VolumeStore) List() ([]volume.Volume, []string, error)
- func (s *VolumeStore) Purge(name string)
- func (s *VolumeStore) Refs(v volume.Volume) []string
- func (s *VolumeStore) Remove(v volume.Volume) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInUse ¶ added in v1.10.0
IsInUse returns a boolean indicating whether the error indicates that a volume is in use
func IsNameConflict ¶ added in v1.10.0
IsNameConflict returns a boolean indicating whether the error indicates that a volume name is already taken
func IsNotExist ¶ added in v1.10.0
IsNotExist returns a boolean indicating whether the error indicates that the volume does not exist
Types ¶
type OpErr ¶ added in v1.10.0
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 // Refs is the list of references associated with the resource. Refs []string }
OpErr is the error type returned by functions in the store package. It describes the operation, volume name, and error.
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(rootPath string) (*VolumeStore, error)
New initializes a VolumeStore to keep reference counting of volumes in the system.
func (*VolumeStore) Create ¶
func (s *VolumeStore) Create(name, driverName string, opts, labels map[string]string) (volume.Volume, error)
Create creates a volume with the given name and driver. This is just like CreateWithRef() except we don't store a reference while holding the lock.
func (*VolumeStore) CreateWithRef ¶ added in v1.10.0
func (s *VolumeStore) CreateWithRef(name, driverName, ref string, opts, labels map[string]string) (volume.Volume, error)
CreateWithRef creates a volume with the given name and driver and stores the ref This ensures there's no race between creating a volume and then storing a reference.
func (*VolumeStore) Dereference ¶ added in v1.10.0
func (s *VolumeStore) Dereference(v volume.Volume, ref string)
Dereference removes the specified reference to the volume
func (*VolumeStore) FilterByDriver ¶
func (s *VolumeStore) FilterByDriver(name string) ([]volume.Volume, error)
FilterByDriver returns the available volumes filtered by driver name
func (*VolumeStore) FilterByUsed ¶ added in v1.10.0
FilterByUsed returns the available volumes filtered by if they are in use or not. `used=true` returns only volumes that are being used, while `used=false` returns only volumes that are not being used.
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) GetWithRef ¶ added in v1.10.0
func (s *VolumeStore) GetWithRef(name, driverName, ref string) (volume.Volume, error)
GetWithRef gets a volume with the given name from the passed in driver and stores the ref This is just like Get(), but we store the reference while holding the lock. This makes sure there are no races between checking for the existence of a volume and adding a reference for it
func (*VolumeStore) List ¶
func (s *VolumeStore) List() ([]volume.Volume, []string, error)
List proxies to all registered volume drivers to get the full list of volumes If a driver returns a volume that has name which conflicts with another volume from a different driver, the first volume is chosen and the conflicting volume is dropped.
func (*VolumeStore) Purge ¶ added in v1.13.0
func (s *VolumeStore) Purge(name string)
Purge allows the cleanup of internal data on docker in case the internal data is out of sync with volumes driver plugins.