volume

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataFileMaxSize = 4 * 1024
)

Variables

This section is empty.

Functions

func WithLimiter

func WithLimiter(limiter limit.Limiter) func(*VolumeManager)

func WithMounter

func WithMounter(mounter mount.Interface) func(*VolumeManager)

Types

type AccessType

type AccessType int
const (
	MountAccess AccessType = iota
	BlockAccess
)

type StateManager

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

func NewStateManager

func NewStateManager(workspacePath string) (*StateManager, error)

func (*StateManager) DeleteVolumeState

func (s *StateManager) DeleteVolumeState(id string) error

func (*StateManager) GetTotalVolumesSize

func (s *StateManager) GetTotalVolumesSize() int64

func (*StateManager) GetVolumeStateByID

func (s *StateManager) GetVolumeStateByID(id string) *VolumeState

func (*StateManager) GetVolumeStateByName

func (s *StateManager) GetVolumeStateByName(name string) *VolumeState

func (*StateManager) GetVolumes

func (s *StateManager) GetVolumes() []VolumeState

func (*StateManager) SaveVolumeState

func (s *StateManager) SaveVolumeState(volume *VolumeState) (err error)

type VolumeManager

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

func NewVolumeManager

func NewVolumeManager(volumesDir string, sm *StateManager, options ...VolumeManagerOption) (*VolumeManager, error)

func (*VolumeManager) CreateVolume

func (v *VolumeManager) CreateVolume(volID, name string, capacity int64, volAccessType AccessType) error

func (*VolumeManager) DeleteVolume

func (v *VolumeManager) DeleteVolume(volID string) error

func (*VolumeManager) GetAvailableCapacity

func (v *VolumeManager) GetAvailableCapacity() (int64, error)

func (*VolumeManager) GetVolumeStateByID

func (v *VolumeManager) GetVolumeStateByID(id string) *VolumeState

func (*VolumeManager) GetVolumeStateByName

func (v *VolumeManager) GetVolumeStateByName(name string) *VolumeState

func (*VolumeManager) Mount

func (v *VolumeManager) Mount(volumeID, targetPath, fsType string, mountOptions []string) error

func (*VolumeManager) SupportedAccessTypes

func (v *VolumeManager) SupportedAccessTypes() []AccessType

func (*VolumeManager) SupportedFilesystems

func (v *VolumeManager) SupportedFilesystems() []string

func (*VolumeManager) Unmount

func (v *VolumeManager) Unmount(targetPath string) error

type VolumeManagerOption

type VolumeManagerOption func(v *VolumeManager)

type VolumeState

type VolumeState struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	LimitID uint32 `json:"limitID"`
	Size    int64  `json:"size"`
}

func (*VolumeState) IsEmpty

func (vs *VolumeState) IsEmpty() bool

func (*VolumeState) VolumePath

func (vs *VolumeState) VolumePath(volumesDir string) string

Jump to

Keyboard shortcuts

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