github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/api/server/router/volume/backend.go (about) 1 package volume // import "github.com/docker/docker/api/server/router/volume" 2 3 import ( 4 "context" 5 6 "github.com/docker/docker/volume/service/opts" 7 // TODO return types need to be refactored into pkg 8 "github.com/docker/docker/api/types" 9 "github.com/docker/docker/api/types/filters" 10 "github.com/docker/docker/api/types/volume" 11 ) 12 13 // Backend is the methods that need to be implemented to provide 14 // volume specific functionality 15 type Backend interface { 16 List(ctx context.Context, filter filters.Args) ([]*volume.Volume, []string, error) 17 Get(ctx context.Context, name string, opts ...opts.GetOption) (*volume.Volume, error) 18 Create(ctx context.Context, name, driverName string, opts ...opts.CreateOption) (*volume.Volume, error) 19 Remove(ctx context.Context, name string, opts ...opts.RemoveOption) error 20 Prune(ctx context.Context, pruneFilters filters.Args) (*types.VolumesPruneReport, error) 21 } 22 23 // ClusterBackend is the backend used for Swarm Cluster Volumes. Regular 24 // volumes go through the volume service, but to avoid across-dependency 25 // between the cluster package and the volume package, we simply provide two 26 // backends here. 27 type ClusterBackend interface { 28 GetVolume(nameOrID string) (volume.Volume, error) 29 GetVolumes(options volume.ListOptions) ([]*volume.Volume, error) 30 CreateVolume(volume volume.CreateOptions) (*volume.Volume, error) 31 RemoveVolume(nameOrID string, force bool) error 32 UpdateVolume(nameOrID string, version uint64, volume volume.UpdateOptions) error 33 IsManager() bool 34 }