vgmgr

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package vgmgr is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExcludeFilter added in v0.2.4

type ExcludeFilter interface {
	Apply(id uint32) bool
}

ExcludeFilter applies on an ID to check if it should be excluded

func NewExcludeIDFilter added in v0.2.4

func NewExcludeIDFilter(ids IDSet) ExcludeFilter

type ExcludeIDFilter added in v0.2.4

type ExcludeIDFilter struct {
	ExcludeIDs map[uint32]struct{}
}

ExcludeIDFilter The sp freeze pool decides excludeIDFilter ExcludeIDs. When this filter is applied on a sp's id, meeting the condition means it is one of freeze sp should be excluded.

func (*ExcludeIDFilter) Apply added in v0.2.4

func (f *ExcludeIDFilter) Apply(id uint32) bool

type GVGPickFilter

type GVGPickFilter interface {
	// CheckFamily returns true when match pick request condition.
	CheckFamily(familyID uint32) bool
	// CheckGVG returns true when match pick request condition.
	CheckGVG(gvgMeta *GlobalVirtualGroupMeta) bool
}

GVGPickFilter is used to check sp pick condition.

type GenerateGVGSecondarySPsPolicy

type GenerateGVGSecondarySPsPolicy interface {
	// AddCandidateSP is used to add candidate sp.
	AddCandidateSP(spID uint32)
	// GenerateGVGSecondarySPs returns gvg secondary sp list.
	GenerateGVGSecondarySPs() ([]uint32, error)
}

GenerateGVGSecondarySPsPolicy is used to generate gvg secondary sp list.

type GlobalVirtualGroupMeta

type GlobalVirtualGroupMeta struct {
	ID                   uint32
	FamilyID             uint32
	PrimarySPID          uint32
	SecondarySPIDs       []uint32
	SecondarySPEndpoints []string
	UsedStorageSize      uint64
	StakingStorageSize   uint64 // init by staking deposit / staking price
}

GlobalVirtualGroupMeta defines global virtual group meta which is used by sp.

type IDSet added in v0.2.4

type IDSet = map[uint32]struct{}

type MockExcludeFilter added in v0.2.4

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

MockExcludeFilter is a mock of ExcludeFilter interface.

func NewMockExcludeFilter added in v0.2.4

func NewMockExcludeFilter(ctrl *gomock.Controller) *MockExcludeFilter

NewMockExcludeFilter creates a new mock instance.

func (*MockExcludeFilter) Apply added in v0.2.4

func (m *MockExcludeFilter) Apply(id uint32) bool

Apply mocks base method.

func (*MockExcludeFilter) EXPECT added in v0.2.4

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

type MockExcludeFilterMockRecorder added in v0.2.4

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

MockExcludeFilterMockRecorder is the mock recorder for MockExcludeFilter.

func (*MockExcludeFilterMockRecorder) Apply added in v0.2.4

Apply indicates an expected call of Apply.

type MockGVGPickFilter added in v0.2.4

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

MockGVGPickFilter is a mock of GVGPickFilter interface.

func NewMockGVGPickFilter added in v0.2.4

func NewMockGVGPickFilter(ctrl *gomock.Controller) *MockGVGPickFilter

NewMockGVGPickFilter creates a new mock instance.

func (*MockGVGPickFilter) CheckFamily added in v0.2.4

func (m *MockGVGPickFilter) CheckFamily(familyID uint32) bool

CheckFamily mocks base method.

func (*MockGVGPickFilter) CheckGVG added in v0.2.4

func (m *MockGVGPickFilter) CheckGVG(gvgMeta *GlobalVirtualGroupMeta) bool

CheckGVG mocks base method.

func (*MockGVGPickFilter) EXPECT added in v0.2.4

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

type MockGVGPickFilterMockRecorder added in v0.2.4

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

MockGVGPickFilterMockRecorder is the mock recorder for MockGVGPickFilter.

func (*MockGVGPickFilterMockRecorder) CheckFamily added in v0.2.4

func (mr *MockGVGPickFilterMockRecorder) CheckFamily(familyID any) *gomock.Call

CheckFamily indicates an expected call of CheckFamily.

func (*MockGVGPickFilterMockRecorder) CheckGVG added in v0.2.4

func (mr *MockGVGPickFilterMockRecorder) CheckGVG(gvgMeta any) *gomock.Call

CheckGVG indicates an expected call of CheckGVG.

type MockGenerateGVGSecondarySPsPolicy added in v0.2.4

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

MockGenerateGVGSecondarySPsPolicy is a mock of GenerateGVGSecondarySPsPolicy interface.

func NewMockGenerateGVGSecondarySPsPolicy added in v0.2.4

func NewMockGenerateGVGSecondarySPsPolicy(ctrl *gomock.Controller) *MockGenerateGVGSecondarySPsPolicy

NewMockGenerateGVGSecondarySPsPolicy creates a new mock instance.

func (*MockGenerateGVGSecondarySPsPolicy) AddCandidateSP added in v0.2.4

func (m *MockGenerateGVGSecondarySPsPolicy) AddCandidateSP(spID uint32)

AddCandidateSP mocks base method.

func (*MockGenerateGVGSecondarySPsPolicy) EXPECT added in v0.2.4

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

func (*MockGenerateGVGSecondarySPsPolicy) GenerateGVGSecondarySPs added in v0.2.4

func (m *MockGenerateGVGSecondarySPsPolicy) GenerateGVGSecondarySPs() ([]uint32, error)

GenerateGVGSecondarySPs mocks base method.

type MockGenerateGVGSecondarySPsPolicyMockRecorder added in v0.2.4

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

MockGenerateGVGSecondarySPsPolicyMockRecorder is the mock recorder for MockGenerateGVGSecondarySPsPolicy.

func (*MockGenerateGVGSecondarySPsPolicyMockRecorder) AddCandidateSP added in v0.2.4

AddCandidateSP indicates an expected call of AddCandidateSP.

func (*MockGenerateGVGSecondarySPsPolicyMockRecorder) GenerateGVGSecondarySPs added in v0.2.4

func (mr *MockGenerateGVGSecondarySPsPolicyMockRecorder) GenerateGVGSecondarySPs() *gomock.Call

GenerateGVGSecondarySPs indicates an expected call of GenerateGVGSecondarySPs.

type MockSPPickFilter added in v0.2.4

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

MockSPPickFilter is a mock of SPPickFilter interface.

func NewMockSPPickFilter added in v0.2.4

func NewMockSPPickFilter(ctrl *gomock.Controller) *MockSPPickFilter

NewMockSPPickFilter creates a new mock instance.

func (*MockSPPickFilter) Check added in v0.2.4

func (m *MockSPPickFilter) Check(spID uint32) bool

Check mocks base method.

func (*MockSPPickFilter) EXPECT added in v0.2.4

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

type MockSPPickFilterMockRecorder added in v0.2.4

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

MockSPPickFilterMockRecorder is the mock recorder for MockSPPickFilter.

func (*MockSPPickFilterMockRecorder) Check added in v0.2.4

func (mr *MockSPPickFilterMockRecorder) Check(spID any) *gomock.Call

Check indicates an expected call of Check.

type MockVGFPickFilter added in v0.2.4

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

MockVGFPickFilter is a mock of VGFPickFilter interface.

func NewMockVGFPickFilter added in v0.2.4

func NewMockVGFPickFilter(ctrl *gomock.Controller) *MockVGFPickFilter

NewMockVGFPickFilter creates a new mock instance.

func (*MockVGFPickFilter) Check added in v0.2.4

func (m *MockVGFPickFilter) Check(vgfID uint32) bool

Check mocks base method.

func (*MockVGFPickFilter) EXPECT added in v0.2.4

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

type MockVGFPickFilterMockRecorder added in v0.2.4

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

MockVGFPickFilterMockRecorder is the mock recorder for MockVGFPickFilter.

func (*MockVGFPickFilterMockRecorder) Check added in v0.2.4

func (mr *MockVGFPickFilterMockRecorder) Check(vgfID any) *gomock.Call

Check indicates an expected call of Check.

type MockVirtualGroupManager added in v0.2.4

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

MockVirtualGroupManager is a mock of VirtualGroupManager interface.

func NewMockVirtualGroupManager added in v0.2.4

func NewMockVirtualGroupManager(ctrl *gomock.Controller) *MockVirtualGroupManager

NewMockVirtualGroupManager creates a new mock instance.

func (*MockVirtualGroupManager) EXPECT added in v0.2.4

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

func (*MockVirtualGroupManager) ForceRefreshMeta added in v0.2.4

func (m *MockVirtualGroupManager) ForceRefreshMeta() error

ForceRefreshMeta mocks base method.

func (*MockVirtualGroupManager) FreezeSPAndGVGs added in v0.2.4

func (m *MockVirtualGroupManager) FreezeSPAndGVGs(spID uint32, gvgs []*types0.GlobalVirtualGroup)

FreezeSPAndGVGs mocks base method.

func (*MockVirtualGroupManager) GenerateGlobalVirtualGroupMeta added in v0.2.4

func (m *MockVirtualGroupManager) GenerateGlobalVirtualGroupMeta(genPolicy GenerateGVGSecondarySPsPolicy, excludeSPsFilter ExcludeFilter) (*GlobalVirtualGroupMeta, error)

GenerateGlobalVirtualGroupMeta mocks base method.

func (*MockVirtualGroupManager) PickGlobalVirtualGroup added in v0.2.4

func (m *MockVirtualGroupManager) PickGlobalVirtualGroup(vgfID uint32, excludeGVGsFilter ExcludeFilter) (*GlobalVirtualGroupMeta, error)

PickGlobalVirtualGroup mocks base method.

func (*MockVirtualGroupManager) PickGlobalVirtualGroupForBucketMigrate added in v0.2.4

func (m *MockVirtualGroupManager) PickGlobalVirtualGroupForBucketMigrate(filter GVGPickFilter) (*GlobalVirtualGroupMeta, error)

PickGlobalVirtualGroupForBucketMigrate mocks base method.

func (*MockVirtualGroupManager) PickSPByFilter added in v0.2.4

func (m *MockVirtualGroupManager) PickSPByFilter(filter SPPickFilter) (*types.StorageProvider, error)

PickSPByFilter mocks base method.

func (*MockVirtualGroupManager) PickVirtualGroupFamily added in v0.2.4

func (m *MockVirtualGroupManager) PickVirtualGroupFamily(filterByGvgList *PickVGFByGVGFilter) (*VirtualGroupFamilyMeta, error)

PickVirtualGroupFamily mocks base method.

func (*MockVirtualGroupManager) QuerySPByID added in v0.2.4

func (m *MockVirtualGroupManager) QuerySPByID(spID uint32) (*types.StorageProvider, error)

QuerySPByID mocks base method.

type MockVirtualGroupManagerMockRecorder added in v0.2.4

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

MockVirtualGroupManagerMockRecorder is the mock recorder for MockVirtualGroupManager.

func (*MockVirtualGroupManagerMockRecorder) ForceRefreshMeta added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) ForceRefreshMeta() *gomock.Call

ForceRefreshMeta indicates an expected call of ForceRefreshMeta.

func (*MockVirtualGroupManagerMockRecorder) FreezeSPAndGVGs added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) FreezeSPAndGVGs(spID, gvgs any) *gomock.Call

FreezeSPAndGVGs indicates an expected call of FreezeSPAndGVGs.

func (*MockVirtualGroupManagerMockRecorder) GenerateGlobalVirtualGroupMeta added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) GenerateGlobalVirtualGroupMeta(genPolicy, excludeSPsFilter any) *gomock.Call

GenerateGlobalVirtualGroupMeta indicates an expected call of GenerateGlobalVirtualGroupMeta.

func (*MockVirtualGroupManagerMockRecorder) PickGlobalVirtualGroup added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) PickGlobalVirtualGroup(vgfID, excludeGVGsFilter any) *gomock.Call

PickGlobalVirtualGroup indicates an expected call of PickGlobalVirtualGroup.

func (*MockVirtualGroupManagerMockRecorder) PickGlobalVirtualGroupForBucketMigrate added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) PickGlobalVirtualGroupForBucketMigrate(filter any) *gomock.Call

PickGlobalVirtualGroupForBucketMigrate indicates an expected call of PickGlobalVirtualGroupForBucketMigrate.

func (*MockVirtualGroupManagerMockRecorder) PickSPByFilter added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) PickSPByFilter(filter any) *gomock.Call

PickSPByFilter indicates an expected call of PickSPByFilter.

func (*MockVirtualGroupManagerMockRecorder) PickVirtualGroupFamily added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) PickVirtualGroupFamily(filterByGvgList any) *gomock.Call

PickVirtualGroupFamily indicates an expected call of PickVirtualGroupFamily.

func (*MockVirtualGroupManagerMockRecorder) QuerySPByID added in v0.2.4

func (mr *MockVirtualGroupManagerMockRecorder) QuerySPByID(spID any) *gomock.Call

QuerySPByID indicates an expected call of QuerySPByID.

type NewVirtualGroupManager

type NewVirtualGroupManager = func(selfOperatorAddress string, chainClient consensus.Consensus, gfspClient gfspclient.GfSpClientAPI, enableHealthyChecker bool) (VirtualGroupManager, error)

NewVirtualGroupManager is the virtual group manager init api.

type PickVGFByGVGFilter added in v1.0.4

type PickVGFByGVGFilter struct {
	BlackListSPs map[uint32]struct{}
}

func NewPickVGFByGVGFilter added in v1.0.4

func NewPickVGFByGVGFilter(blackListSPs []uint32) *PickVGFByGVGFilter

func (*PickVGFByGVGFilter) Check added in v1.0.4

Check checks if a family has at least 1 valid GVG(gvg doest not contain blacklist Sp)

type PickVGFFilter added in v0.2.4

type PickVGFFilter struct {
	AvailableVgfIDSet map[uint32]struct{}
}

func NewPickVGFFilter added in v0.2.4

func NewPickVGFFilter(availableVgfIDs []uint32) *PickVGFFilter

func (*PickVGFFilter) Check added in v0.2.4

func (p *PickVGFFilter) Check(vgfID uint32) bool

type SPPickFilter

type SPPickFilter interface {
	// Check returns true when match pick request condition.
	Check(spID uint32) bool
}

SPPickFilter is used to check sp pick condition.

type VGFPickFilter added in v0.2.4

type VGFPickFilter interface {
	Check(vgfID uint32) bool
}

VGFPickFilter is used to check virtual group families qualification

type VirtualGroupFamilyMeta

type VirtualGroupFamilyMeta struct {
	ID                       uint32
	PrimarySPID              uint32
	FamilyUsedStorageSize    uint64 // init by gvgMap
	FamilyStakingStorageSize uint64 // init by gvgMap
	GVGMap                   map[uint32]*GlobalVirtualGroupMeta
}

VirtualGroupFamilyMeta defines virtual group family meta which is used by sp.

type VirtualGroupManager

type VirtualGroupManager interface {
	// PickVirtualGroupFamily pick a virtual group family(If failed to pick,
	// new VGF will be automatically created on the chain) in get create bucket approval workflow.
	PickVirtualGroupFamily(filterByGvgList *PickVGFByGVGFilter) (*VirtualGroupFamilyMeta, error)
	// PickGlobalVirtualGroup picks a global virtual group(If failed to pick,
	// new GVG will be created by primary SP) in replicate/seal object workflow.
	PickGlobalVirtualGroup(vgfID uint32, excludeGVGsFilter ExcludeFilter) (*GlobalVirtualGroupMeta, error)
	// PickGlobalVirtualGroupForBucketMigrate picks a global virtual group(If failed to pick,
	// new GVG will be created by primary SP) in replicate/seal object workflow.
	PickGlobalVirtualGroupForBucketMigrate(filter GVGPickFilter) (*GlobalVirtualGroupMeta, error)
	// ForceRefreshMeta is used to query metadata service and refresh the virtual group manager meta.
	// if pick func returns ErrStaledMetadata, the caller need force refresh from metadata and retry pick.
	ForceRefreshMeta() error
	// GenerateGlobalVirtualGroupMeta is used to generate a new global virtual group meta, the caller need send a tx to chain.
	GenerateGlobalVirtualGroupMeta(genPolicy GenerateGVGSecondarySPsPolicy, excludeSPsFilter ExcludeFilter) (*GlobalVirtualGroupMeta, error)
	// PickSPByFilter picks sp which is match pick filter condition.
	PickSPByFilter(filter SPPickFilter) (*sptypes.StorageProvider, error)
	// QuerySPByID returns sp proto.
	QuerySPByID(spID uint32) (*sptypes.StorageProvider, error)
	// FreezeSPAndGVGs puts the secondary SP and its joining Global virtual groups into the freeze pool for a specific period,
	// For those SPs which are in the pool will be skipped when creating a GVG, GVGs in the pool will not be chosen to seal Object
	// until released
	FreezeSPAndGVGs(spID uint32, gvgs []*virtualgrouptypes.GlobalVirtualGroup)
}

VirtualGroupManager is used to provide virtual group api.

Jump to

Keyboard shortcuts

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