storage

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 5 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrVolumeExist indicates that a volume already exists.
	ErrVolumeExist = errors.New("Volume already exists")
)

Functions

func SplitName added in v0.3.0

func SplitName(name string) (string, string, error)

SplitName splits a docker volume name from policy/name safely.

Types

type CRUDDriver

type CRUDDriver interface {
	NamedDriver
	ValidatingDriver

	// Create a volume.
	Create(DriverOptions) error

	// Format a volume.
	Format(DriverOptions) error

	// Destroy a volume.
	Destroy(DriverOptions) error

	// List Volumes. May be scoped by storage parameters or other data.
	List(ListOptions) ([]Volume, error)

	// Exists returns true if a volume exists. Otherwise, it returns false.
	Exists(DriverOptions) (bool, error)
}

CRUDDriver performs CRUD operations.

type DriverOptions

type DriverOptions struct {
	Source    string
	Volume    Volume
	FSOptions FSOptions
	Timeout   time.Duration
	Options   map[string]string
}

DriverOptions are options frequently passed as the keystone for operations. See Driver for more information.

func (*DriverOptions) Validate

func (do *DriverOptions) Validate() error

Validate validates driver options to ensure they are compatible with all storage drivers.

type FSOptions

type FSOptions struct {
	Type          string
	CreateCommand string
}

FSOptions encapsulates the parameters to create and manipulate filesystems.

type ListOptions

type ListOptions struct {
	Params Params
}

ListOptions is a set of parameters used for the List operation of Driver.

type Mount

type Mount struct {
	Device   string
	Path     string
	DevMajor uint
	DevMinor uint
	Volume   Volume
}

A Mount is the resulting attributes of a Mount or Unmount operation.

type MountDriver

type MountDriver interface {
	NamedDriver
	ValidatingDriver

	// Mount a Volume
	Mount(DriverOptions) (*Mount, error)

	// Unmount a volume
	Unmount(DriverOptions) error

	// Mounted shows any volumes that belong to volplugin on the host, in
	// their native representation. They yield a *Mount.
	Mounted(time.Duration) ([]*Mount, error)

	// MountPath describes the path at which the volume should be mounted.
	MountPath(DriverOptions) (string, error)
}

MountDriver mounts volumes.

type NamedDriver

type NamedDriver interface {
	// Name returns the string associated with the storage backed of the driver
	Name() string
}

NamedDriver is a named driver and has a method called Name()

type Params

type Params map[string]string

Params are parameters that relate directly to the location of the storage.

type SnapshotDriver

type SnapshotDriver interface {
	NamedDriver
	ValidatingDriver

	// CreateSnapshot creates a named snapshot for the volume. Any error will be returned.
	CreateSnapshot(string, DriverOptions) error

	// RemoveSnapshot removes a named snapshot for the volume. Any error will be returned.
	RemoveSnapshot(string, DriverOptions) error

	// ListSnapshots returns an array of snapshot names provided a maximum number
	// of snapshots to be returned. Any error will be returned.
	ListSnapshots(DriverOptions) ([]string, error)

	// CopySnapshot copies a snapshot into a new volume. Takes a DriverOptions,
	// snap and volume name (string). Returns error on failure.
	CopySnapshot(DriverOptions, string, string) error
}

SnapshotDriver manages snapshots.

type ValidatingDriver

type ValidatingDriver interface {
	Validate(*DriverOptions) error
}

ValidatingDriver implements Validate() against storage.DriverOptions.

type Volume

type Volume struct {
	Name   string
	Size   uint64
	Params Params
}

Volume is the basic representation of a volume name and its parameters.

func (Volume) Validate

func (v Volume) Validate() error

Validate validates volume options to ensure they are compatible with all storage drivers.

Directories

Path Synopsis
nfs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL