Documentation
¶
Overview ¶
Package volume provides functionality for Docker volume management
Index ¶
- Variables
- type BackupOptions
- type CreateOptions
- type EventOptions
- type GetOptions
- type ListOptions
- type PruneOptions
- type RemoveOptions
- type RestoreOptions
- type Service
- type UpdateOptions
- type VolumeClient
- type VolumeManager
- func (m *VolumeManager) Backup(ctx context.Context, name string, options BackupOptions) (io.ReadCloser, error)
- func (m *VolumeManager) Create(ctx context.Context, name string, options CreateOptions) (*models.Volume, error)
- func (m *VolumeManager) Get(ctx context.Context, name string, options GetOptions) (*models.Volume, error)
- func (m *VolumeManager) GetEvents(ctx context.Context, options EventOptions) (<-chan events.Message, <-chan error)
- func (m *VolumeManager) InspectRaw(ctx context.Context, name string) (volume.Volume, error)
- func (m *VolumeManager) List(ctx context.Context, options ListOptions) ([]*models.Volume, error)
- func (m *VolumeManager) Prune(ctx context.Context, options PruneOptions) (*volume.PruneReport, error)
- func (m *VolumeManager) Remove(ctx context.Context, name string, options RemoveOptions) error
- func (m *VolumeManager) Restore(ctx context.Context, name string, reader io.Reader, options RestoreOptions) error
- func (m *VolumeManager) Update(ctx context.Context, name string, metadata map[string]string, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVolumeExists indicates that the volume already exists ErrVolumeExists = errors.New("volume already exists") // ErrVolumeNotFound indicates that the volume was not found ErrVolumeNotFound = errors.New("volume not found") // ErrVolumeInUse indicates that the volume is in use ErrVolumeInUse = errors.New("volume in use") )
Common errors
Functions ¶
This section is empty.
Types ¶
type BackupOptions ¶
type BackupOptions struct {
CompressFormat string
IncludeMetadata bool
Timeout time.Duration
Logger *logrus.Logger
}
BackupOptions defines options for backing up a volume
type CreateOptions ¶
type CreateOptions struct {
Driver string
DriverOpts map[string]string
Labels map[string]string
Timeout time.Duration
Logger *logrus.Logger
}
CreateOptions defines options for creating a volume
type EventOptions ¶
type EventOptions struct {
Filters filters.Args
BufferSize int
Since time.Time
Until time.Time
Logger *logrus.Logger
}
EventOptions defines options for volume events
type GetOptions ¶
GetOptions defines options for getting a volume
type ListOptions ¶
ListOptions defines options for listing volumes
type PruneOptions ¶
PruneOptions defines options for pruning volumes
type RemoveOptions ¶
RemoveOptions defines options for removing a volume
type RestoreOptions ¶
type RestoreOptions struct {
OverwriteIfExists bool
ExtractFormat string
RestoreMetadata bool
Timeout time.Duration
Logger *logrus.Logger
}
RestoreOptions defines options for restoring a volume
type Service ¶
type Service interface {
// Create creates a new volume
Create(ctx context.Context, name string, options CreateOptions) (*models.Volume, error)
// Get gets a volume by name
Get(ctx context.Context, name string, options GetOptions) (*models.Volume, error)
// List lists volumes
List(ctx context.Context, options ListOptions) ([]*models.Volume, error)
// Remove removes a volume
Remove(ctx context.Context, name string, options RemoveOptions) error
// Prune removes unused volumes
Prune(ctx context.Context, options PruneOptions) (*volume.PruneReport, error) // Use volume.PruneReport
// Backup creates a backup of a volume
Backup(ctx context.Context, name string, options BackupOptions) (io.ReadCloser, error)
// Restore restores a volume from a backup
Restore(ctx context.Context, name string, reader io.Reader, options RestoreOptions) error
// InspectRaw gets the raw information about a volume
InspectRaw(ctx context.Context, name string) (volume.Volume, error) // Use volume.Volume
// GetEvents subscribes to volume events
GetEvents(ctx context.Context, options EventOptions) (<-chan events.Message, <-chan error) // Use events.Message for now
// Update updates a volume's metadata
Update(ctx context.Context, name string, metadata map[string]string, options UpdateOptions) error
}
Service defines the interface for Docker volume operations
type UpdateOptions ¶
UpdateOptions defines options for updating a volume
type VolumeClient ¶
type VolumeClient interface {
// VolumeCreate creates a volume
VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
// VolumeInspect inspects a volume
VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
// VolumeList lists volumes
VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error)
// VolumeRemove removes a volume
VolumeRemove(ctx context.Context, volumeID string, force bool) error
// VolumePrune prunes volumes
VolumePrune(ctx context.Context, pruneFilters filters.Args) (volume.PruneReport, error) // Use volume.PruneReport
// Events streams events from the Docker daemon
Events(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error) // Use events.ListOptions
}
VolumeClient defines the required Docker client methods for volume operations
type VolumeManager ¶
type VolumeManager struct {
// contains filtered or unexported fields
}
VolumeManager implements the Service interface
func NewVolumeManager ¶
func NewVolumeManager(client VolumeClient, logger *logrus.Logger) *VolumeManager
NewVolumeManager creates a new VolumeManager
func (*VolumeManager) Backup ¶
func (m *VolumeManager) Backup(ctx context.Context, name string, options BackupOptions) (io.ReadCloser, error)
Backup creates a backup of a volume
func (*VolumeManager) Create ¶
func (m *VolumeManager) Create(ctx context.Context, name string, options CreateOptions) (*models.Volume, error)
Create creates a new volume
func (*VolumeManager) Get ¶
func (m *VolumeManager) Get(ctx context.Context, name string, options GetOptions) (*models.Volume, error)
Get gets a volume by name
func (*VolumeManager) GetEvents ¶
func (m *VolumeManager) GetEvents(ctx context.Context, options EventOptions) (<-chan events.Message, <-chan error)
GetEvents subscribes to volume events
func (*VolumeManager) InspectRaw ¶
InspectRaw gets the raw information about a volume
func (*VolumeManager) List ¶
func (m *VolumeManager) List(ctx context.Context, options ListOptions) ([]*models.Volume, error)
List lists volumes
func (*VolumeManager) Prune ¶
func (m *VolumeManager) Prune(ctx context.Context, options PruneOptions) (*volume.PruneReport, error)
Prune removes unused volumes
func (*VolumeManager) Remove ¶
func (m *VolumeManager) Remove(ctx context.Context, name string, options RemoveOptions) error
Remove removes a volume
func (*VolumeManager) Restore ¶
func (m *VolumeManager) Restore(ctx context.Context, name string, reader io.Reader, options RestoreOptions) error
Restore restores a volume from a backup
func (*VolumeManager) Update ¶
func (m *VolumeManager) Update(ctx context.Context, name string, metadata map[string]string, options UpdateOptions) error
Update updates a volume's metadata
Directories
¶
| Path | Synopsis |
|---|---|
|
Package inspector provides functionality for inspecting Docker volumes
|
Package inspector provides functionality for inspecting Docker volumes |
|
Package manager provides a concrete implementation of the volume.Service interface
|
Package manager provides a concrete implementation of the volume.Service interface |