block

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package block is a generated GoMock package.

Index

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

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

func (*MockAllocator) Pick

func (m *MockAllocator) Pick(ctx context.Context, num int) ([]*metadata.Block, error)

Pick mocks base method.

func (*MockAllocator) PickByVolumes

func (m *MockAllocator) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error)

PickByVolumes mocks base method.

func (*MockAllocator) Run

func (m *MockAllocator) Run(ctx context.Context, kvCli kv.Client, dynamicAllocate bool) error

Run mocks base method.

func (*MockAllocator) Stop

func (m *MockAllocator) Stop()

Stop 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

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.

Jump to

Keyboard shortcuts

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