volume

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const (
	StrategyEmpty       = "empty"
	StrategyCopyOnWrite = "cow"
	StrategyImport      = "import"
)
View Source
const GzipEncoding string = "gzip"
View Source
const ZstdEncoding string = "zstd"

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 ErrUnsupportedStreamEncoding = errors.New("unsupported stream encoding")
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(FilesystemInitVolume) error
	DestroyVolume(FilesystemVolume) error

	CreateCopyOnWriteLayer(FilesystemInitVolume, FilesystemLiveVolume) error

	Recover(Filesystem) 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

	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) 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

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, 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
	GetPrivileged(ctx context.Context, handle string) (bool, error)
	SetPrivileged(ctx context.Context, handle string, privileged bool) error

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

	StreamP2pOut(ctx context.Context, handle string, path string, encoding string, streamInURL string) 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 Volume

type Volume struct {
	Handle     string     `json:"handle"`
	Path       string     `json:"path"`
	Properties Properties `json:"properties"`
	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