2018-02-05 16:05:59 -05:00
|
|
|
package volume // import "github.com/docker/docker/api/server/router/volume"
|
2015-11-02 19:26:45 -05:00
|
|
|
|
|
|
|
import (
|
2018-04-19 18:30:59 -04:00
|
|
|
"context"
|
2017-04-11 15:52:33 -04:00
|
|
|
|
2018-03-22 17:11:03 -04:00
|
|
|
"github.com/docker/docker/volume/service/opts"
|
2015-11-02 19:26:45 -05:00
|
|
|
// TODO return types need to be refactored into pkg
|
2016-09-06 14:46:37 -04:00
|
|
|
"github.com/docker/docker/api/types"
|
2016-11-17 00:46:37 -05:00
|
|
|
"github.com/docker/docker/api/types/filters"
|
2022-03-18 11:33:43 -04:00
|
|
|
"github.com/docker/docker/api/types/volume"
|
2015-11-02 19:26:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Backend is the methods that need to be implemented to provide
|
|
|
|
// volume specific functionality
|
|
|
|
type Backend interface {
|
2022-03-18 11:33:43 -04:00
|
|
|
List(ctx context.Context, filter filters.Args) ([]*volume.Volume, []string, error)
|
|
|
|
Get(ctx context.Context, name string, opts ...opts.GetOption) (*volume.Volume, error)
|
|
|
|
Create(ctx context.Context, name, driverName string, opts ...opts.CreateOption) (*volume.Volume, error)
|
2018-03-22 17:11:03 -04:00
|
|
|
Remove(ctx context.Context, name string, opts ...opts.RemoveOption) error
|
|
|
|
Prune(ctx context.Context, pruneFilters filters.Args) (*types.VolumesPruneReport, error)
|
2015-11-02 19:26:45 -05:00
|
|
|
}
|
2021-05-14 13:38:50 -04:00
|
|
|
|
|
|
|
// ClusterBackend is the backend used for Swarm Cluster Volumes. Regular
|
|
|
|
// volumes go through the volume service, but to avoid across-dependency
|
|
|
|
// between the cluster package and the volume package, we simply provide two
|
|
|
|
// backends here.
|
|
|
|
type ClusterBackend interface {
|
|
|
|
GetVolume(nameOrID string) (volume.Volume, error)
|
|
|
|
GetVolumes(options volume.ListOptions) ([]*volume.Volume, error)
|
|
|
|
CreateVolume(volume volume.CreateOptions) (*volume.Volume, error)
|
|
|
|
RemoveVolume(nameOrID string, force bool) error
|
|
|
|
UpdateVolume(nameOrID string, version uint64, volume volume.UpdateOptions) error
|
|
|
|
IsManager() bool
|
|
|
|
}
|