docker: github.com/docker/docker/volume/service Index | Files | Directories

package service

import "github.com/docker/docker/volume/service"

Index

Package Files

by.go convert.go db.go default_driver.go errors.go restore.go service.go store.go store_unix.go

func IsInUse Uses

func IsInUse(err error) bool

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

func IsNameConflict Uses

func IsNameConflict(err error) bool

IsNameConflict returns a boolean indicating whether the error indicates that a volume name is already taken

func IsNotExist Uses

func IsNotExist(err error) bool

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

type By Uses

type By interface {
    // contains filtered or unexported methods
}

By is an interface which is used to implement filtering on volumes.

func And Uses

func And(bys ...By) By

And creates a `By` combining all the passed in bys using AND logic.

func ByDriver Uses

func ByDriver(drivers ...string) By

ByDriver is `By` that filters based on the driver names that are passed in

func FromList Uses

func FromList(ls *[]volume.Volume, by By) By

FromList returns a By which sets the initial list of volumes to use

func Or Uses

func Or(bys ...By) By

Or creates a `By` combining all the passed in bys using OR logic.

type ByReferenced Uses

type ByReferenced bool

ByReferenced is a `By` that filters based on if the volume has references

type CustomFilter Uses

type CustomFilter filterFunc

CustomFilter is a `By` that is used by callers to provide custom filtering logic.

type OpErr Uses

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.

func (*OpErr) Cause Uses

func (e *OpErr) Cause() error

Cause returns the error the caused this error

func (*OpErr) Error Uses

func (e *OpErr) Error() string

Error satisfies the built-in error interface type.

type VolumeStore Uses

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

VolumeStore is responsible for storing and reference counting volumes.

func NewStore Uses

func NewStore(rootPath string, drivers *drivers.Store) (*VolumeStore, error)

NewStore creates a new volume store at the given path

func (*VolumeStore) CountReferences Uses

func (s *VolumeStore) CountReferences(v volume.Volume) int

CountReferences gives a count of all references for a given volume.

func (*VolumeStore) Create Uses

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 Uses

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 Uses

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) Release Uses

func (s *VolumeStore) Release(ctx context.Context, name string, ref string) error

Release releases the specified reference to the volume

func (*VolumeStore) Remove Uses

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 Uses

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 Uses

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 Uses

func NewVolumeService(root string, pg plugingetter.PluginGetter, rootIDs idtools.Identity, logger volumeEventLogger) (*VolumesService, error)

NewVolumeService creates a new volume service

func (*VolumesService) Create Uses

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 (*VolumesService) Get Uses

func (s *VolumesService) Get(ctx context.Context, name string, getOpts ...opts.GetOption) (*types.Volume, error)

Get returns details about a volume

func (*VolumesService) GetDriverList Uses

func (s *VolumesService) GetDriverList() []string

GetDriverList gets the list of registered volume drivers

func (*VolumesService) List Uses

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 Uses

func (s *VolumesService) LocalVolumesSize(ctx context.Context) ([]*types.Volume, error)

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) Mount Uses

func (s *VolumesService) Mount(ctx context.Context, vol *types.Volume, ref string) (string, error)

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 (*VolumesService) Prune Uses

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) Release Uses

func (s *VolumesService) Release(ctx context.Context, name string, ref string) error

Release releases a volume reference

func (*VolumesService) Remove Uses

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 (*VolumesService) Shutdown Uses

func (s *VolumesService) Shutdown() error

Shutdown shuts down the image service and dependencies

func (*VolumesService) Unmount Uses

func (s *VolumesService) Unmount(ctx context.Context, vol *types.Volume, ref string) error

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.

Directories

PathSynopsis
opts

Package service imports 28 packages (graph) and is imported by 1 packages. Updated 2020-10-08. Refresh now. Tools for package owners.