storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package storage is a generated GoMock package.

Package storage is a generated GoMock package.

Package storage is a generated GoMock package.

Index

Constants

View Source
const (
	LVMask = 1
	VGMask = 1 << 1
	PVMask = 1 << 2
)

consts

Variables

View Source
var (
	ErrorPoolNotFound                 = errors.New("not found pool")
	ErrorReplicaNotFound              = errors.New("not found replica")
	ErrorReplicaExists                = errors.New("already exists replica")
	ErrorInsufficientRequestResources = errors.New("insufficient request resources")
	ErrorOverLimitedRequestResource   = errors.New("over limited request resources")
)

variables

View Source
var (
	ErrNotLVMByteNum = errors.New("LVM byte format unrecognised")
)

variables

Functions

This section is empty.

Types

type DeviceInfo

type DeviceInfo struct {
	OSFileInfo   os.FileInfo
	SysTStat     *syscall.Stat_t
	Path         string
	Name         string
	Major        uint32
	Minor        uint32
	MajMinString string
}

DeviceInfo struct

type LocalDeviceListInterface

type LocalDeviceListInterface interface {
	GetDevicesInfo(string, map[string]struct{}) map[string]*DeviceInfo
}

LocalDeviceListInterface interface

type LocalDiskManager

type LocalDiskManager interface {
	// Discover all disks including HDD, SSD, NVMe, etc..
	DiscoverAvailableDisks() ([]*localstoragev1alpha1.LocalDisk, error)
	GetLocalDisks() (map[string]*localstoragev1alpha1.LocalDisk, error)
}

LocalDiskManager is an interface to manage local disks

type LocalManager

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

LocalManager struct

func NewLocalManager

func NewLocalManager(nodeConf *localstoragev1alpha1.NodeConfig, cli client.Client) *LocalManager

NewLocalManager creates a local manager

func (*LocalManager) NodeConfig

func (lm *LocalManager) NodeConfig() *localstoragev1alpha1.NodeConfig

NodeConfig gets node configuration

func (*LocalManager) PoolManager

func (lm *LocalManager) PoolManager() LocalPoolManager

PoolManager gets pool manager

func (*LocalManager) Register

func (lm *LocalManager) Register() error

Register for local storage

func (*LocalManager) Registry

func (lm *LocalManager) Registry() LocalRegistry

Registry return singleton of local registry

func (*LocalManager) UpdateNodeForVolumeReplica

func (lm *LocalManager) UpdateNodeForVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica)

UpdateNodeForVolumeReplica updates LocalStorageNode for volume replica

func (*LocalManager) VolumeReplicaManager

func (lm *LocalManager) VolumeReplicaManager() LocalVolumeReplicaManager

VolumeReplicaManager gets volume replica manager

type LocalPoolExecutor

type LocalPoolExecutor interface {
	ExtendPools(localDisks []*localstoragev1alpha1.LocalDisk) error
	ExtendPoolsInfo(localDisks map[string]*localstoragev1alpha1.LocalDisk) (map[string]*localstoragev1alpha1.LocalPool, error)
	GetReplicas() (map[string]*localstoragev1alpha1.LocalVolumeReplica, error)
}

LocalPoolExecutor interface

type LocalPoolManager

type LocalPoolManager interface {
	ExtendPools(localDisks []*localstoragev1alpha1.LocalDisk) error

	ExtendPoolsInfo(localDisks map[string]*localstoragev1alpha1.LocalDisk) (map[string]*localstoragev1alpha1.LocalPool, error)

	GetReplicas() (map[string]*localstoragev1alpha1.LocalVolumeReplica, error)
}

LocalPoolManager is an interface to manage local storage pools

type LocalRegistry

type LocalRegistry interface {
	Init()

	Disks() map[string]*localstoragev1alpha1.LocalDisk
	Pools() map[string]*localstoragev1alpha1.LocalPool
	VolumeReplicas() map[string]*localstoragev1alpha1.LocalVolumeReplica
	HasVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) bool
	UpdateNodeForVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica)
	SyncResourcesToNodeCRD(localDisks map[string]*localstoragev1alpha1.LocalDisk) error
}

LocalRegistry interface

type LocalVolumeExecutor

type LocalVolumeExecutor interface {
	CreateVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) (*localstoragev1alpha1.LocalVolumeReplica, error)
	DeleteVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) error
	ExpandVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica, newCapacityBytes int64) (*localstoragev1alpha1.LocalVolumeReplica, error)
	TestVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) (*localstoragev1alpha1.LocalVolumeReplica, error)
	// GetReplicas return all replicas
	GetReplicas() (map[string]*localstoragev1alpha1.LocalVolumeReplica, error)

	// consistencyCheck on all volume replicas by comparing VolumeReplica and underlying volumes
	// will log all the check results for alerting or other purpose, but not block anything
	ConsistencyCheck(crdReplicas map[string]*localstoragev1alpha1.LocalVolumeReplica)
}

LocalVolumeExecutor interface

type LocalVolumeReplicaManager

type LocalVolumeReplicaManager interface {
	CreateVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) (*localstoragev1alpha1.LocalVolumeReplica, error)
	DeleteVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) error
	ExpandVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica, newCapacityBytes int64) (*localstoragev1alpha1.LocalVolumeReplica, error)
	GetVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) (*localstoragev1alpha1.LocalVolumeReplica, error)
	TestVolumeReplica(replica *localstoragev1alpha1.LocalVolumeReplica) (*localstoragev1alpha1.LocalVolumeReplica, error)

	// consistencyCheck on all volume replicas by comparing VolumeReplica and underlying volumes
	// will log all the check results for alerting or other purpose, but not block anything
	ConsistencyCheck()
}

LocalVolumeReplicaManager interface

type MockLocalPoolExecutor

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

MockLocalPoolExecutor is a mock of LocalPoolExecutor interface.

func NewMockLocalPoolExecutor

func NewMockLocalPoolExecutor(ctrl *gomock.Controller) *MockLocalPoolExecutor

NewMockLocalPoolExecutor creates a new mock instance.

func (*MockLocalPoolExecutor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLocalPoolExecutor) ExtendPools

func (m *MockLocalPoolExecutor) ExtendPools(localDisks []*v1alpha1.LocalDisk) error

ExtendPools mocks base method.

func (*MockLocalPoolExecutor) ExtendPoolsInfo

func (m *MockLocalPoolExecutor) ExtendPoolsInfo(localDisks map[string]*v1alpha1.LocalDisk) (map[string]*v1alpha1.LocalPool, error)

ExtendPoolsInfo mocks base method.

func (*MockLocalPoolExecutor) GetReplicas

GetReplicas mocks base method.

type MockLocalPoolExecutorMockRecorder

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

MockLocalPoolExecutorMockRecorder is the mock recorder for MockLocalPoolExecutor.

func (*MockLocalPoolExecutorMockRecorder) ExtendPools

func (mr *MockLocalPoolExecutorMockRecorder) ExtendPools(localDisks interface{}) *gomock.Call

ExtendPools indicates an expected call of ExtendPools.

func (*MockLocalPoolExecutorMockRecorder) ExtendPoolsInfo

func (mr *MockLocalPoolExecutorMockRecorder) ExtendPoolsInfo(localDisks interface{}) *gomock.Call

ExtendPoolsInfo indicates an expected call of ExtendPoolsInfo.

func (*MockLocalPoolExecutorMockRecorder) GetReplicas

func (mr *MockLocalPoolExecutorMockRecorder) GetReplicas() *gomock.Call

GetReplicas indicates an expected call of GetReplicas.

type MockLocalPoolManager

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

MockLocalPoolManager is a mock of LocalPoolManager interface.

func NewMockLocalPoolManager

func NewMockLocalPoolManager(ctrl *gomock.Controller) *MockLocalPoolManager

NewMockLocalPoolManager creates a new mock instance.

func (*MockLocalPoolManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLocalPoolManager) ExtendPools

func (m *MockLocalPoolManager) ExtendPools(localDisks []*v1alpha1.LocalDisk) error

ExtendPools mocks base method.

func (*MockLocalPoolManager) ExtendPoolsInfo

func (m *MockLocalPoolManager) ExtendPoolsInfo(localDisks map[string]*v1alpha1.LocalDisk) (map[string]*v1alpha1.LocalPool, error)

ExtendPoolsInfo mocks base method.

func (*MockLocalPoolManager) GetReplicas

func (m *MockLocalPoolManager) GetReplicas() (map[string]*v1alpha1.LocalVolumeReplica, error)

GetReplicas mocks base method.

type MockLocalPoolManagerMockRecorder

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

MockLocalPoolManagerMockRecorder is the mock recorder for MockLocalPoolManager.

func (*MockLocalPoolManagerMockRecorder) ExtendPools

func (mr *MockLocalPoolManagerMockRecorder) ExtendPools(localDisks interface{}) *gomock.Call

ExtendPools indicates an expected call of ExtendPools.

func (*MockLocalPoolManagerMockRecorder) ExtendPoolsInfo

func (mr *MockLocalPoolManagerMockRecorder) ExtendPoolsInfo(localDisks interface{}) *gomock.Call

ExtendPoolsInfo indicates an expected call of ExtendPoolsInfo.

func (*MockLocalPoolManagerMockRecorder) GetReplicas

func (mr *MockLocalPoolManagerMockRecorder) GetReplicas() *gomock.Call

GetReplicas indicates an expected call of GetReplicas.

type MockLocalRegistry

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

MockLocalRegistry is a mock of LocalRegistry interface.

func NewMockLocalRegistry

func NewMockLocalRegistry(ctrl *gomock.Controller) *MockLocalRegistry

NewMockLocalRegistry creates a new mock instance.

func (*MockLocalRegistry) Disks

func (m *MockLocalRegistry) Disks() map[string]*v1alpha1.LocalDisk

Disks mocks base method.

func (*MockLocalRegistry) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLocalRegistry) HasVolumeReplica

func (m *MockLocalRegistry) HasVolumeReplica(replica *v1alpha1.LocalVolumeReplica) bool

HasVolumeReplica mocks base method.

func (*MockLocalRegistry) Init

func (m *MockLocalRegistry) Init()

Init mocks base method.

func (*MockLocalRegistry) Pools

func (m *MockLocalRegistry) Pools() map[string]*v1alpha1.LocalPool

Pools mocks base method.

func (*MockLocalRegistry) SyncResourcesToNodeCRD

func (m *MockLocalRegistry) SyncResourcesToNodeCRD(localDisks map[string]*v1alpha1.LocalDisk) error

SyncResourcesToNodeCRD mocks base method.

func (*MockLocalRegistry) UpdateNodeForVolumeReplica

func (m *MockLocalRegistry) UpdateNodeForVolumeReplica(replica *v1alpha1.LocalVolumeReplica)

UpdateNodeForVolumeReplica mocks base method.

func (*MockLocalRegistry) VolumeReplicas

func (m *MockLocalRegistry) VolumeReplicas() map[string]*v1alpha1.LocalVolumeReplica

VolumeReplicas mocks base method.

type MockLocalRegistryMockRecorder

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

MockLocalRegistryMockRecorder is the mock recorder for MockLocalRegistry.

func (*MockLocalRegistryMockRecorder) Disks

Disks indicates an expected call of Disks.

func (*MockLocalRegistryMockRecorder) HasVolumeReplica

func (mr *MockLocalRegistryMockRecorder) HasVolumeReplica(replica interface{}) *gomock.Call

HasVolumeReplica indicates an expected call of HasVolumeReplica.

func (*MockLocalRegistryMockRecorder) Init

Init indicates an expected call of Init.

func (*MockLocalRegistryMockRecorder) Pools

Pools indicates an expected call of Pools.

func (*MockLocalRegistryMockRecorder) SyncResourcesToNodeCRD

func (mr *MockLocalRegistryMockRecorder) SyncResourcesToNodeCRD(localDisks interface{}) *gomock.Call

SyncResourcesToNodeCRD indicates an expected call of SyncResourcesToNodeCRD.

func (*MockLocalRegistryMockRecorder) UpdateNodeForVolumeReplica

func (mr *MockLocalRegistryMockRecorder) UpdateNodeForVolumeReplica(replica interface{}) *gomock.Call

UpdateNodeForVolumeReplica indicates an expected call of UpdateNodeForVolumeReplica.

func (*MockLocalRegistryMockRecorder) VolumeReplicas

func (mr *MockLocalRegistryMockRecorder) VolumeReplicas() *gomock.Call

VolumeReplicas indicates an expected call of VolumeReplicas.

type MockLocalVolumeExecutor

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

MockLocalVolumeExecutor is a mock of LocalVolumeExecutor interface.

func NewMockLocalVolumeExecutor

func NewMockLocalVolumeExecutor(ctrl *gomock.Controller) *MockLocalVolumeExecutor

NewMockLocalVolumeExecutor creates a new mock instance.

func (*MockLocalVolumeExecutor) ConsistencyCheck

func (m *MockLocalVolumeExecutor) ConsistencyCheck(crdReplicas map[string]*v1alpha1.LocalVolumeReplica)

ConsistencyCheck mocks base method.

func (*MockLocalVolumeExecutor) CreateVolumeReplica

CreateVolumeReplica mocks base method.

func (*MockLocalVolumeExecutor) DeleteVolumeReplica

func (m *MockLocalVolumeExecutor) DeleteVolumeReplica(replica *v1alpha1.LocalVolumeReplica) error

DeleteVolumeReplica mocks base method.

func (*MockLocalVolumeExecutor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLocalVolumeExecutor) ExpandVolumeReplica

func (m *MockLocalVolumeExecutor) ExpandVolumeReplica(replica *v1alpha1.LocalVolumeReplica, newCapacityBytes int64) (*v1alpha1.LocalVolumeReplica, error)

ExpandVolumeReplica mocks base method.

func (*MockLocalVolumeExecutor) GetReplicas

GetReplicas mocks base method.

func (*MockLocalVolumeExecutor) TestVolumeReplica

TestVolumeReplica mocks base method.

type MockLocalVolumeExecutorMockRecorder

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

MockLocalVolumeExecutorMockRecorder is the mock recorder for MockLocalVolumeExecutor.

func (*MockLocalVolumeExecutorMockRecorder) ConsistencyCheck

func (mr *MockLocalVolumeExecutorMockRecorder) ConsistencyCheck(crdReplicas interface{}) *gomock.Call

ConsistencyCheck indicates an expected call of ConsistencyCheck.

func (*MockLocalVolumeExecutorMockRecorder) CreateVolumeReplica

func (mr *MockLocalVolumeExecutorMockRecorder) CreateVolumeReplica(replica interface{}) *gomock.Call

CreateVolumeReplica indicates an expected call of CreateVolumeReplica.

func (*MockLocalVolumeExecutorMockRecorder) DeleteVolumeReplica

func (mr *MockLocalVolumeExecutorMockRecorder) DeleteVolumeReplica(replica interface{}) *gomock.Call

DeleteVolumeReplica indicates an expected call of DeleteVolumeReplica.

func (*MockLocalVolumeExecutorMockRecorder) ExpandVolumeReplica

func (mr *MockLocalVolumeExecutorMockRecorder) ExpandVolumeReplica(replica, newCapacityBytes interface{}) *gomock.Call

ExpandVolumeReplica indicates an expected call of ExpandVolumeReplica.

func (*MockLocalVolumeExecutorMockRecorder) GetReplicas

func (mr *MockLocalVolumeExecutorMockRecorder) GetReplicas() *gomock.Call

GetReplicas indicates an expected call of GetReplicas.

func (*MockLocalVolumeExecutorMockRecorder) TestVolumeReplica

func (mr *MockLocalVolumeExecutorMockRecorder) TestVolumeReplica(replica interface{}) *gomock.Call

TestVolumeReplica indicates an expected call of TestVolumeReplica.

type MockLocalVolumeReplicaManager

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

MockLocalVolumeReplicaManager is a mock of LocalVolumeReplicaManager interface.

func NewMockLocalVolumeReplicaManager

func NewMockLocalVolumeReplicaManager(ctrl *gomock.Controller) *MockLocalVolumeReplicaManager

NewMockLocalVolumeReplicaManager creates a new mock instance.

func (*MockLocalVolumeReplicaManager) ConsistencyCheck

func (m *MockLocalVolumeReplicaManager) ConsistencyCheck()

ConsistencyCheck mocks base method.

func (*MockLocalVolumeReplicaManager) CreateVolumeReplica

CreateVolumeReplica mocks base method.

func (*MockLocalVolumeReplicaManager) DeleteVolumeReplica

func (m *MockLocalVolumeReplicaManager) DeleteVolumeReplica(replica *v1alpha1.LocalVolumeReplica) error

DeleteVolumeReplica mocks base method.

func (*MockLocalVolumeReplicaManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLocalVolumeReplicaManager) ExpandVolumeReplica

func (m *MockLocalVolumeReplicaManager) ExpandVolumeReplica(replica *v1alpha1.LocalVolumeReplica, newCapacityBytes int64) (*v1alpha1.LocalVolumeReplica, error)

ExpandVolumeReplica mocks base method.

func (*MockLocalVolumeReplicaManager) GetVolumeReplica

GetVolumeReplica mocks base method.

func (*MockLocalVolumeReplicaManager) TestVolumeReplica

TestVolumeReplica mocks base method.

type MockLocalVolumeReplicaManagerMockRecorder

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

MockLocalVolumeReplicaManagerMockRecorder is the mock recorder for MockLocalVolumeReplicaManager.

func (*MockLocalVolumeReplicaManagerMockRecorder) ConsistencyCheck

func (mr *MockLocalVolumeReplicaManagerMockRecorder) ConsistencyCheck() *gomock.Call

ConsistencyCheck indicates an expected call of ConsistencyCheck.

func (*MockLocalVolumeReplicaManagerMockRecorder) CreateVolumeReplica

func (mr *MockLocalVolumeReplicaManagerMockRecorder) CreateVolumeReplica(replica interface{}) *gomock.Call

CreateVolumeReplica indicates an expected call of CreateVolumeReplica.

func (*MockLocalVolumeReplicaManagerMockRecorder) DeleteVolumeReplica

func (mr *MockLocalVolumeReplicaManagerMockRecorder) DeleteVolumeReplica(replica interface{}) *gomock.Call

DeleteVolumeReplica indicates an expected call of DeleteVolumeReplica.

func (*MockLocalVolumeReplicaManagerMockRecorder) ExpandVolumeReplica

func (mr *MockLocalVolumeReplicaManagerMockRecorder) ExpandVolumeReplica(replica, newCapacityBytes interface{}) *gomock.Call

ExpandVolumeReplica indicates an expected call of ExpandVolumeReplica.

func (*MockLocalVolumeReplicaManagerMockRecorder) GetVolumeReplica

func (mr *MockLocalVolumeReplicaManagerMockRecorder) GetVolumeReplica(replica interface{}) *gomock.Call

GetVolumeReplica indicates an expected call of GetVolumeReplica.

func (*MockLocalVolumeReplicaManagerMockRecorder) TestVolumeReplica

func (mr *MockLocalVolumeReplicaManagerMockRecorder) TestVolumeReplica(replica interface{}) *gomock.Call

TestVolumeReplica indicates an expected call of TestVolumeReplica.

Jump to

Keyboard shortcuts

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