volume

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ETCDVolumeMetadataDir = "/volume/"
)

Variables

View Source
var IDLen int
View Source
var IDLenLock sync.Once

Functions

func DecodeVolumeType

func DecodeVolumeType(s string) (apistructs.VolumeType, error)

DecodeVolumeType Parse the prefix of `s` to get VolumeType

func EncodeVolumeType

func EncodeVolumeType(t VolumeType) (string, error)

EncodeVolumeType Get the corresponding hex code representation according to VolumeType

Types

type AttachCallback

type AttachCallback func(runtime *apistructs.ServiceGroup) (VolumeInfo, error)

type AttachDest

type AttachDest apistructs.AttachDest

func (AttachDest) Equal

func (d AttachDest) Equal(d2 AttachDest) bool

Are the 2 AttachDest the same

func (AttachDest) String

func (d AttachDest) String() string

func (AttachDest) Validate

func (d AttachDest) Validate() error

type GC

type GC interface {
}

Each backend volume implements GC

type Volume

type Volume interface {
	// Return volume type
	Type() VolumeType

	// create volume
	// Creating a volume does not necessarily actually create it, but only creates metadata, such as LocalVolume
	Create(config VolumeCreateConfig) (VolumeInfo, error)

	// Return volume information
	Info(ID VolumeIdentity) (VolumeInfo, error)

	// Attach an existing volume
	Attach(ID VolumeIdentity, dst AttachDest) (AttachCallback, error)

	// UnAttach
	UnAttach(ID VolumeIdentity, dst AttachDest) (VolumeInfo, error)

	Delete(ID VolumeIdentity, force bool) error
}

func GetDriver

func GetDriver(drivers map[VolumeType]Volume, ID VolumeIdentity) (Volume, error)

func NewVolumeImpl

func NewVolumeImpl(drivers map[apistructs.VolumeType]Volume) Volume

type VolumeCreateConfig

type VolumeCreateConfig struct {
	Size int
	Type VolumeType
}

func (VolumeCreateConfig) String

func (c VolumeCreateConfig) String() string

type VolumeIdentity

type VolumeIdentity string

VolumeIdentity Represents volume ID or volume name

func NewVolumeID

func NewVolumeID(config VolumeCreateConfig) (VolumeIdentity, error)

func NewVolumeName

func NewVolumeName(name string) VolumeIdentity

func (VolumeIdentity) IsNotUUID

func (i VolumeIdentity) IsNotUUID() bool

TODO: Need to better distinguish between name and ID

func (VolumeIdentity) String

func (i VolumeIdentity) String() string

type VolumeImpl

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

func (VolumeImpl) Attach

func (VolumeImpl) Create

func (i VolumeImpl) Create(config VolumeCreateConfig) (VolumeInfo, error)

func (VolumeImpl) Delete

func (i VolumeImpl) Delete(ID VolumeIdentity, force bool) error

func (VolumeImpl) Info

func (i VolumeImpl) Info(ID VolumeIdentity) (VolumeInfo, error)

func (VolumeImpl) Type

func (VolumeImpl) Type() VolumeType

func (VolumeImpl) UnAttach

func (i VolumeImpl) UnAttach(ID VolumeIdentity, dst AttachDest) (VolumeInfo, error)

type VolumeInfo

type VolumeInfo = apistructs.VolumeInfo

type VolumeReference

type VolumeReference = apistructs.VolumeReference

type VolumeType

type VolumeType = apistructs.VolumeType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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