Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeVolumeType(s string) (apistructs.VolumeType, error)
- func EncodeVolumeType(t VolumeType) (string, error)
- type AttachCallback
- type AttachDest
- type GC
- type Volume
- type VolumeCreateConfig
- type VolumeIdentity
- type VolumeImpl
- func (i VolumeImpl) Attach(ID VolumeIdentity, dst AttachDest) (AttachCallback, error)
- func (i VolumeImpl) Create(config VolumeCreateConfig) (VolumeInfo, error)
- func (i VolumeImpl) Delete(ID VolumeIdentity, force bool) error
- func (i VolumeImpl) Info(ID VolumeIdentity) (VolumeInfo, error)
- func (VolumeImpl) Type() VolumeType
- func (i VolumeImpl) UnAttach(ID VolumeIdentity, dst AttachDest) (VolumeInfo, error)
- type VolumeInfo
- type VolumeReference
- type VolumeType
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 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 VolumeCreateConfigFrom ¶
func VolumeCreateConfigFrom(r apistructs.VolumeCreateRequest) (VolumeCreateConfig, error)
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 (i VolumeImpl) Attach(ID VolumeIdentity, dst AttachDest) (AttachCallback, error)
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
Click to show internal directories.
Click to hide internal directories.