Documentation ¶
Index ¶
- func IsInUse(err error) bool
- func IsNameConflict(err error) bool
- func IsNotExist(err error) bool
- type By
- type ByReferenced
- type CustomFilter
- type OpErr
- type VolumeStore
- func (s *VolumeStore) CountReferences(v volume.Volume) int
- func (s *VolumeStore) Create(ctx context.Context, name, driverName string, createOpts ...opts.CreateOption) (volume.Volume, error)
- func (s *VolumeStore) Find(ctx context.Context, by By) (vols []volume.Volume, warnings []string, err error)
- func (s *VolumeStore) Get(ctx context.Context, name string, getOptions ...opts.GetOption) (volume.Volume, error)
- func (s *VolumeStore) Release(ctx context.Context, name string, ref string) error
- func (s *VolumeStore) Remove(ctx context.Context, v volume.Volume, rmOpts ...opts.RemoveOption) error
- func (s *VolumeStore) Shutdown() error
- type VolumesService
- func (s *VolumesService) Create(ctx context.Context, name, driverName string, opts ...opts.CreateOption) (*types.Volume, error)
- func (s *VolumesService) Get(ctx context.Context, name string, getOpts ...opts.GetOption) (*types.Volume, error)
- func (s *VolumesService) GetDriverList() []string
- func (s *VolumesService) List(ctx context.Context, filter filters.Args) (volumesOut []*types.Volume, warnings []string, err error)
- func (s *VolumesService) LocalVolumesSize(ctx context.Context) ([]*types.Volume, error)
- func (s *VolumesService) Mount(ctx context.Context, vol *types.Volume, ref string) (string, error)
- func (s *VolumesService) Prune(ctx context.Context, filter filters.Args) (*types.VolumesPruneReport, error)
- func (s *VolumesService) Release(ctx context.Context, name string, ref string) error
- func (s *VolumesService) Remove(ctx context.Context, name string, rmOpts ...opts.RemoveOption) error
- func (s *VolumesService) Shutdown() error
- func (s *VolumesService) Unmount(ctx context.Context, vol *types.Volume, ref string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInUse ¶
IsInUse returns a boolean indicating whether the error indicates that a volume is in use
func IsNameConflict ¶
IsNameConflict returns a boolean indicating whether the error indicates that a volume name is already taken
func IsNotExist ¶
IsNotExist returns a boolean indicating whether the error indicates that the volume does not exist
Types ¶
type By ¶
type By interface {
// contains filtered or unexported methods
}
By is an interface which is used to implement filtering on volumes.
type ByReferenced ¶
type ByReferenced bool
ByReferenced is a `By` that filters based on if the volume has references
type CustomFilter ¶
type CustomFilter filterFunc
CustomFilter is a `By` that is used by callers to provide custom filtering logic.
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 // 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 NewStore ¶
func NewStore(rootPath string, drivers *drivers.Store) (*VolumeStore, error)
NewStore creates a new volume store at the given path
func (*VolumeStore) CountReferences ¶
func (s *VolumeStore) CountReferences(v volume.Volume) int
CountReferences gives a count of all references for a given volume.
func (*VolumeStore) Create ¶
func (s *VolumeStore) Create(ctx context.Context, name, driverName string, createOpts ...opts.CreateOption) (volume.Volume, error)
Create creates a volume with the given name and driver If the volume needs to be created with a reference to prevent race conditions with volume cleanup, make sure to use the `CreateWithReference` option.
func (*VolumeStore) Find ¶
func (s *VolumeStore) Find(ctx context.Context, by By) (vols []volume.Volume, warnings []string, err error)
Find lists volumes filtered by the past in filter. 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) Get ¶
func (s *VolumeStore) Get(ctx context.Context, name string, getOptions ...opts.GetOption) (volume.Volume, error)
Get looks if a volume with the given name exists and returns it if so
func (*VolumeStore) Remove ¶
func (s *VolumeStore) Remove(ctx context.Context, v volume.Volume, rmOpts ...opts.RemoveOption) error
Remove removes the requested volume. A volume is not removed if it has any refs
func (*VolumeStore) Shutdown ¶
func (s *VolumeStore) Shutdown() error
Shutdown releases all resources used by the volume store It does not make any changes to volumes, drivers, etc.
type VolumesService ¶
type VolumesService struct {
// contains filtered or unexported fields
}
VolumesService manages access to volumes
func NewVolumeService ¶
func NewVolumeService(root string, pg plugingetter.PluginGetter, rootIDs idtools.Identity, logger volumeEventLogger) (*VolumesService, error)
NewVolumeService creates a new volume service
func (*VolumesService) Create ¶
func (s *VolumesService) Create(ctx context.Context, name, driverName string, opts ...opts.CreateOption) (*types.Volume, error)
Create creates a volume
func (*VolumesService) Get ¶
func (s *VolumesService) Get(ctx context.Context, name string, getOpts ...opts.GetOption) (*types.Volume, error)
Get gets a volume
func (*VolumesService) GetDriverList ¶
func (s *VolumesService) GetDriverList() []string
GetDriverList gets the list of registered volume drivers
func (*VolumesService) List ¶
func (s *VolumesService) List(ctx context.Context, filter filters.Args) (volumesOut []*types.Volume, warnings []string, err error)
List gets the list of volumes which match the past in filters If filters is nil or empty all volumes are returned.
func (*VolumesService) LocalVolumesSize ¶
LocalVolumesSize gets all local volumes and fetches their size on disk Note that this intentionally skips volumes which have mount options. Typically volumes with mount options are not really local even if they are using the local driver.
func (*VolumesService) Prune ¶
func (s *VolumesService) Prune(ctx context.Context, filter filters.Args) (*types.VolumesPruneReport, error)
Prune removes (local) volumes which match the past in filter arguments. Note that this intentionally skips volumes with mount options as there would be no space reclaimed in this case.
func (*VolumesService) Remove ¶
func (s *VolumesService) Remove(ctx context.Context, name string, rmOpts ...opts.RemoveOption) error
Remove removes a volume
func (*VolumesService) Shutdown ¶
func (s *VolumesService) Shutdown() error
Shutdown shuts down the image service and dependencies