volume

package
v0.0.0-...-ef2e20d Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrategyEmpty       = "empty"
	StrategyCopyOnWrite = "cow"
	StrategyImport      = "import"
)

Variables

View Source
var ErrNoParentVolumeProvided = errors.New("no parent volume provided")
View Source
var ErrNoStrategy = errors.New("no strategy given")
View Source
var ErrParentVolumeNotFound = errors.New("parent volume not found")
View Source
var ErrUnknownStrategy = errors.New("unknown strategy")
View Source
var ErrVolumeDoesNotExist = errors.New("volume does not exist")
View Source
var ErrVolumeIsCorrupted = errors.New("volume is corrupted")

Functions

This section is empty.

Types

type COWStrategy

type COWStrategy struct {
	ParentHandle string
}

func (COWStrategy) Materialize

func (strategy COWStrategy) Materialize(logger lager.Logger, handle string, fs Filesystem) (FilesystemInitVolume, error)

type Driver

type Driver interface {
	CreateVolume(path string) error
	DestroyVolume(path string) error
	GetVolumeSizeInBytes(path string) (int64, error)

	CreateCopyOnWriteLayer(path string, parent string) error
}

type EmptyStrategy

type EmptyStrategy struct{}

func (EmptyStrategy) Materialize

func (EmptyStrategy) Materialize(logger lager.Logger, handle string, fs Filesystem) (FilesystemInitVolume, error)

type Filesystem

type Filesystem interface {
	NewVolume(string) (FilesystemInitVolume, error)
	LookupVolume(string) (FilesystemLiveVolume, bool, error)
	ListVolumes() ([]FilesystemLiveVolume, error)
}

func NewFilesystem

func NewFilesystem(driver Driver, parentDir string) (Filesystem, error)

type FilesystemInitVolume

type FilesystemInitVolume interface {
	FilesystemVolume

	Initialize() (FilesystemLiveVolume, error)
}

type FilesystemLiveVolume

type FilesystemLiveVolume interface {
	FilesystemVolume

	SizeInBytes() (int64, error)

	NewSubvolume(handle string) (FilesystemInitVolume, error)
}

type FilesystemVolume

type FilesystemVolume interface {
	Handle() string

	DataPath() string

	LoadProperties() (Properties, error)
	StoreProperties(Properties) error

	LoadTTL() (TTL, time.Time, error)
	StoreTTL(TTL) (time.Time, error)

	LoadPrivileged() (bool, error)
	StorePrivileged(bool) error

	Parent() (FilesystemLiveVolume, bool, error)

	Destroy() error
}

FilesystemVolume represents the state of a volume's data and metadata.

Operations will return ErrVolumeDoesNotExist if the data on disk has disappeared.

type ImportStrategy

type ImportStrategy struct {
	Path string
}

func (ImportStrategy) Materialize

func (strategy ImportStrategy) Materialize(logger lager.Logger, handle string, fs Filesystem) (FilesystemInitVolume, error)

type LockManager

type LockManager interface {
	Lock(key string)
	Unlock(key string)
}

func NewLockManager

func NewLockManager() LockManager

type Metadata

type Metadata struct {
	// contains filtered or unexported fields
}

func (*Metadata) ExpiresAt

func (md *Metadata) ExpiresAt() (time.Time, error)

func (*Metadata) IsPrivileged

func (md *Metadata) IsPrivileged() (bool, error)

func (*Metadata) Properties

func (md *Metadata) Properties() (Properties, error)

Properties File

func (*Metadata) StorePrivileged

func (md *Metadata) StorePrivileged(isPrivileged bool) error

func (*Metadata) StoreProperties

func (md *Metadata) StoreProperties(properties Properties) error

func (*Metadata) StoreTTL

func (md *Metadata) StoreTTL(ttl TTL) (time.Time, error)

func (*Metadata) TTL

func (md *Metadata) TTL() (TTL, time.Time, error)

TTL File

type Properties

type Properties map[string]string

func (Properties) HasProperties

func (p Properties) HasProperties(other Properties) bool

func (Properties) UpdateProperty

func (p Properties) UpdateProperty(name string, value string) Properties

type Repository

type Repository interface {
	ListVolumes(queryProperties Properties) (Volumes, []string, error)
	GetVolume(handle string) (Volume, bool, error)
	GetVolumeStats(handle string) (VolumeStats, bool, error)
	CreateVolume(handle string, strategy Strategy, properties Properties, ttlInSeconds uint, isPrivileged bool) (Volume, error)
	DestroyVolume(handle string) error
	DestroyVolumeAndDescendants(handle string) error

	SetProperty(handle string, propertyName string, propertyValue string) error
	SetTTL(handle string, ttl uint) error
	SetPrivileged(handle string, privileged bool) error

	StreamIn(handle string, path string, stream io.Reader) (bool, error)
	StreamOut(handle string, path string, dest io.Writer) error

	VolumeParent(handle string) (Volume, bool, error)
}

func NewRepository

func NewRepository(
	logger lager.Logger,
	filesystem Filesystem,
	locker LockManager,
	privilegedNamespacer uidgid.Namespacer,
	unprivilegedNamespacer uidgid.Namespacer,
) Repository

type Strategerizer

type Strategerizer interface {
	StrategyFor(baggageclaim.VolumeRequest) (Strategy, error)
}

func NewStrategerizer

func NewStrategerizer() Strategerizer

type Strategy

type Strategy interface {
	Materialize(lager.Logger, string, Filesystem) (FilesystemInitVolume, error)
}

type TTL

type TTL uint

func (TTL) Duration

func (ttl TTL) Duration() time.Duration

func (TTL) IsUnlimited

func (ttl TTL) IsUnlimited() bool

type Volume

type Volume struct {
	Handle     string     `json:"handle"`
	Path       string     `json:"path"`
	Properties Properties `json:"properties"`
	TTL        TTL        `json:"ttl,omitempty"`
	ExpiresAt  time.Time  `json:"expires_at"`
	Privileged bool       `json:"privileged"`
}

type VolumeState

type VolumeState string

type VolumeStats

type VolumeStats struct {
	SizeInBytes int64 `json:"size_in_bytes"`
}

type Volumes

type Volumes []Volume

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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