import "github.com/docker/docker/volume/service"
by.go convert.go db.go default_driver.go errors.go restore.go service.go store.go store_unix.go
IsInUse returns a boolean indicating whether the error indicates that a volume is in use
IsNameConflict returns a boolean indicating whether the error indicates that a volume name is already taken
IsNotExist returns a boolean indicating whether the error indicates that the volume does not exist
type By interface {
// contains filtered or unexported methods
}
By is an interface which is used to implement filtering on volumes.
And creates a `By` combining all the passed in bys using AND logic.
ByDriver is `By` that filters based on the driver names that are passed in
FromList returns a By which sets the initial list of volumes to use
Or creates a `By` combining all the passed in bys using OR logic.
ByReferenced is a `By` that filters based on if the volume has references
type CustomFilter filterFunc
CustomFilter is a `By` that is used by callers to provide custom filtering logic.
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.
Cause returns the error the caused this error
Error satisfies the built-in error interface type.
type VolumeStore struct {
// contains filtered or unexported fields
}
VolumeStore is responsible for storing and reference counting volumes.
NewStore creates a new volume store at the given path
func (s *VolumeStore) CountReferences(v volume.Volume) int
CountReferences gives a count of all references for a given volume.
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 (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 (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
Release releases the specified reference to the volume
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 (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 struct {
// contains filtered or unexported fields
}
VolumesService manages access to volumes This is used as the main access point for volumes to higher level services and the API.
func NewVolumeService(root string, pg plugingetter.PluginGetter, rootIDs idtools.Identity, logger volumeEventLogger) (*VolumesService, error)
NewVolumeService creates a new volume service
func (s *VolumesService) Create(ctx context.Context, name, driverName string, opts ...opts.CreateOption) (*types.Volume, error)
Create creates a volume If the caller is creating this volume to be consumed immediately, it is expected that the caller specifies a reference ID. This reference ID will protect this volume from removal.
A good example for a reference ID is a container's ID. When whatever is going to reference this volume is removed the caller should defeference the volume by calling `Release`.
func (s *VolumesService) Get(ctx context.Context, name string, getOpts ...opts.GetOption) (*types.Volume, error)
Get returns details about a volume
func (s *VolumesService) GetDriverList() []string
GetDriverList gets the list of registered volume drivers
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.
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.
Mount mounts the volume Callers should specify a uniqe reference for each Mount/Unmount pair.
Example: “`go mountID := "randomString" s.Mount(ctx, vol, mountID) s.Unmount(ctx, vol, mountID) “`
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.
Release releases a volume reference
func (s *VolumesService) Remove(ctx context.Context, name string, rmOpts ...opts.RemoveOption) error
Remove removes a volume An error is returned if the volume is still referenced.
func (s *VolumesService) Shutdown() error
Shutdown shuts down the image service and dependencies
Unmount unmounts the volume. Note that depending on the implementation, the volume may still be mounted due to other resources using it.
The reference specified here should be the same reference specified during `Mount` and should be unique for each mount/unmount pair. See `Mount` documentation for an example.
Path | Synopsis |
---|---|
opts |
Package service imports 28 packages (graph) and is imported by 1 packages. Updated 2020-10-08. Refresh now. Tools for package owners.