volume

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: Apache-2.0 Imports: 15 Imported by: 5

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 ErrPromiseAlreadyExists = errors.New("promise already exists in list")
View Source
var ErrPromiseCanceled = errors.New("promise was canceled")
View Source
var ErrPromiseNotPending = errors.New("promise is not pending")
View Source
var ErrPromiseStillPending = errors.New("promise is still pending")
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, streamer Streamer) (FilesystemInitVolume, error)

type Driver

type Driver interface {
	CreateVolume(path string) error
	DestroyVolume(path string) 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, streamer Streamer) (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

	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
	FollowSymlinks bool
}

func (ImportStrategy) Materialize

func (strategy ImportStrategy) Materialize(logger lager.Logger, handle string, fs Filesystem, streamer Streamer) (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 Promise

type Promise interface {
	IsPending() bool
	GetValue() (Volume, error, error)
	Fulfill(Volume) error
	Reject(error) error
}

func NewPromise

func NewPromise() Promise

type PromiseList

type PromiseList interface {
	AddPromise(handle string, promise Promise) error
	GetPromise(handle string) Promise
	RemovePromise(handle string)
}

func NewPromiseList

func NewPromiseList() PromiseList

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(ctx context.Context, queryProperties Properties) (Volumes, []string, error)
	GetVolume(ctx context.Context, handle string) (Volume, bool, error)
	CreateVolume(ctx context.Context, handle string, strategy Strategy, properties Properties, ttlInSeconds uint, isPrivileged bool) (Volume, error)
	DestroyVolume(ctx context.Context, handle string) error
	DestroyVolumeAndDescendants(ctx context.Context, handle string) error

	SetProperty(ctx context.Context, handle string, propertyName string, propertyValue string) error
	SetTTL(ctx context.Context, handle string, ttl uint) error
	SetPrivileged(ctx context.Context, handle string, privileged bool) error

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

	VolumeParent(ctx context.Context, handle string) (Volume, bool, error)
}

func NewRepository

func NewRepository(
	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, Streamer) (FilesystemInitVolume, error)
}

type Streamer added in v1.2.0

type Streamer interface {
	In(io.Reader, string, bool) (bool, error)
	Out(io.Writer, string, bool) 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 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