volume

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2016 License: Apache-2.0 Imports: 8 Imported by: 1,143

Documentation

Index

Constants

View Source
const (

	// RXHostDir is the first option of a source
	RXHostDir = `[a-z]:\\(?:[^\\/:*?"<>|\r\n]+\\?)*`
	// RXName is the second option of a source
	RXName = `[^\\/:*?"<>|\r\n]+`
	// RXReservedNames are reserved names not possible on Windows
	RXReservedNames = `(con)|(prn)|(nul)|(aux)|(com[1-9])|(lpt[1-9])`

	// RXSource is the combined possibilities for a source
	RXSource = `((?P<source>((` + RXHostDir + `)|(` + RXName + `))):)?`

	// RXDestination is the regex expression for the mount destination
	RXDestination = `(?P<destination>([a-z]):((?:\\[^\\/:*?"<>\r\n]+)*\\?))`

	// RXMode is the regex expression for the mode of the mount
	RXMode = `(:(?P<mode>(?i)rw))?`
)
View Source
const DefaultDriverName string = "local"

DefaultDriverName is the driver name used for the driver implemented in the local package.

View Source
const DefaultPropagationMode string = ""

DefaultPropagationMode is used only in linux. In other cases it returns empty string.

Variables

This section is empty.

Functions

func GetPropagation added in v1.10.0

func GetPropagation(mode string) string

GetPropagation is not supported. Return empty string.

func HasPropagation added in v1.10.0

func HasPropagation(mode string) bool

HasPropagation checks if there is a valid propagation mode present in passed string. Returns true if a valid propagatio mode specifier is present, false otherwise.

func IsVolumeNameValid added in v1.10.0

func IsVolumeNameValid(name string) (bool, error)

IsVolumeNameValid checks a volume name in a platform specific manner.

func ParseVolumesFrom added in v1.10.0

func ParseVolumesFrom(spec string) (string, string, error)

ParseVolumesFrom ensure that the supplied volumes-from is valid.

func ReadWrite added in v1.8.0

func ReadWrite(mode string) bool

ReadWrite tells you if a mode string is a valid read-write mode or not.

func ValidMountMode added in v1.9.0

func ValidMountMode(mode string) bool

ValidMountMode will make sure the mount mode is valid. returns if it's a valid mount mode or not.

Types

type Driver

type Driver interface {
	// Name returns the name of the volume driver.
	Name() string
	// Create makes a new volume with the given id.
	Create(name string, opts map[string]string) (Volume, error)
	// Remove deletes the volume.
	Remove(vol Volume) (err error)
	// List lists all the volumes the driver has
	List() ([]Volume, error)
	// Get retreives the volume with the requested name
	Get(name string) (Volume, error)
}

Driver is for creating and removing volumes.

type MountPoint added in v1.10.0

type MountPoint struct {
	Source      string // Container host directory
	Destination string // Inside the container
	RW          bool   // True if writable
	Name        string // Name set by user
	Driver      string // Volume driver to use
	Volume      Volume `json:"-"`

	// Note Mode is not used on Windows
	Mode string `json:"Relabel"` // Originally field was `Relabel`"

	// Note Propagation is not used on Windows
	Propagation string // Mount propagation string
	Named       bool   // specifies if the mountpoint was specified by name
}

MountPoint is the intersection point between a volume and a container. It specifies which volume is to be used and where inside a container it should be mounted.

func ParseMountSpec added in v1.10.0

func ParseMountSpec(spec string, volumeDriver string) (*MountPoint, error)

ParseMountSpec validates the configuration of mount information is valid.

func (*MountPoint) BackwardsCompatible added in v1.10.0

func (m *MountPoint) BackwardsCompatible() bool

BackwardsCompatible decides whether this mount point can be used in old versions of Docker or not. Windows volumes are never backwards compatible.

func (*MountPoint) Path added in v1.10.0

func (m *MountPoint) Path() string

Path returns the path of a volume in a mount point.

func (*MountPoint) Setup added in v1.10.0

func (m *MountPoint) Setup() (string, error)

Setup sets up a mount point by either mounting the volume if it is configured, or creating the source directory if supplied.

type Volume

type Volume interface {
	// Name returns the name of the volume
	Name() string
	// DriverName returns the name of the driver which owns this volume.
	DriverName() string
	// Path returns the absolute path to the volume.
	Path() string
	// Mount mounts the volume and returns the absolute path to
	// where it can be consumed.
	Mount() (string, error)
	// Unmount unmounts the volume when it is no longer in use.
	Unmount() error
}

Volume is a place to store data. It is backed by a specific driver, and can be mounted.

Directories

Path Synopsis
Package local provides the default implementation for volumes.
Package local provides the default implementation for volumes.

Jump to

Keyboard shortcuts

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