Documentation ¶
Overview ¶
Package block is a generated GoMock package.
Index ¶
- type Allocator
- type MockAllocator
- func (m *MockAllocator) EXPECT() *MockAllocatorMockRecorder
- func (m *MockAllocator) Pick(ctx context.Context, num int) ([]*metadata.Block, error)
- func (m *MockAllocator) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error)
- func (m *MockAllocator) Run(ctx context.Context, kvCli kv.Client, dynamicAllocate bool) error
- func (m *MockAllocator) Stop()
- type MockAllocatorMockRecorder
- func (mr *MockAllocatorMockRecorder) Pick(ctx, num interface{}) *gomock.Call
- func (mr *MockAllocatorMockRecorder) PickByVolumes(ctx, volumes interface{}) *gomock.Call
- func (mr *MockAllocatorMockRecorder) Run(ctx, kvCli, dynamicAllocate interface{}) *gomock.Call
- func (mr *MockAllocatorMockRecorder) Stop() *gomock.Call
- type VolumeSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator interface { Run(ctx context.Context, kvCli kv.Client, dynamicAllocate bool) error Pick(ctx context.Context, num int) ([]*metadata.Block, error) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error) Stop() }
func NewAllocator ¶
func NewAllocator(defaultBlockCapacity int64, selector VolumeSelector) Allocator
type MockAllocator ¶
type MockAllocator struct {
// contains filtered or unexported fields
}
MockAllocator is a mock of Allocator interface.
func NewMockAllocator ¶
func NewMockAllocator(ctrl *gomock.Controller) *MockAllocator
NewMockAllocator creates a new mock instance.
func (*MockAllocator) EXPECT ¶
func (m *MockAllocator) EXPECT() *MockAllocatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAllocator) PickByVolumes ¶
func (m *MockAllocator) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error)
PickByVolumes mocks base method.
type MockAllocatorMockRecorder ¶
type MockAllocatorMockRecorder struct {
// contains filtered or unexported fields
}
MockAllocatorMockRecorder is the mock recorder for MockAllocator.
func (*MockAllocatorMockRecorder) Pick ¶
func (mr *MockAllocatorMockRecorder) Pick(ctx, num interface{}) *gomock.Call
Pick indicates an expected call of Pick.
func (*MockAllocatorMockRecorder) PickByVolumes ¶
func (mr *MockAllocatorMockRecorder) PickByVolumes(ctx, volumes interface{}) *gomock.Call
PickByVolumes indicates an expected call of PickByVolumes.
func (*MockAllocatorMockRecorder) Run ¶
func (mr *MockAllocatorMockRecorder) Run(ctx, kvCli, dynamicAllocate interface{}) *gomock.Call
Run indicates an expected call of Run.
func (*MockAllocatorMockRecorder) Stop ¶
func (mr *MockAllocatorMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
type VolumeSelector ¶
type VolumeSelector interface { // Select return #{num} server.Instance as an array, #{size} tell selector how large Block // will be created. The same server.Instance maybe placed in different index of returned array // in order to make sure that length of returned array equals with #{num} Select(num int, size int64) []server.Instance // SelectByID return a specified server.Instance with ServerID SelectByID(id vanus.ID) server.Instance // GetAllVolume get all volumes GetAllVolume() []server.Instance }
VolumeSelector selector for Block creating. The implementation based on different algorithm, typical is Round-Robin.
func NewVolumeRoundRobin ¶
func NewVolumeRoundRobin(f func() []server.Instance) VolumeSelector
NewVolumeRoundRobin an implementation of round-robin algorithm. Which need a callback function for getting all server.Instance in the current cluster.