mockcluster

package
v3.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

Cluster is used to mock clusterInfo for test use.

func NewCluster

func NewCluster(opt *mockoption.ScheduleOptions) *Cluster

NewCluster creates a new Cluster

func (*Cluster) AddLabelsStore

func (mc *Cluster) AddLabelsStore(storeID uint64, regionCount int, labels map[string]string)

AddLabelsStore adds store with specified count of region and labels.

func (*Cluster) AddLeaderRegion

func (mc *Cluster) AddLeaderRegion(regionID uint64, leaderID uint64, followerIds ...uint64) *core.RegionInfo

AddLeaderRegion adds region with specified leader and followers.

func (*Cluster) AddLeaderRegionWithRange

func (mc *Cluster) AddLeaderRegionWithRange(regionID uint64, startKey string, endKey string, leaderID uint64, followerIds ...uint64)

AddLeaderRegionWithRange adds region with specified leader, followers and key range.

func (*Cluster) AddLeaderRegionWithReadInfo

func (mc *Cluster) AddLeaderRegionWithReadInfo(
	regionID uint64, leaderID uint64,
	readBytes, readKeys uint64,
	reportInterval uint64,
	followerIds []uint64)

AddLeaderRegionWithReadInfo adds region with specified leader, followers and read info.

func (*Cluster) AddLeaderRegionWithWriteInfo

func (mc *Cluster) AddLeaderRegionWithWriteInfo(
	regionID uint64, leaderID uint64,
	writtenBytes, writtenKeys uint64,
	reportInterval uint64,
	followerIds []uint64)

AddLeaderRegionWithWriteInfo adds region with specified leader, followers and write info.

func (*Cluster) AddLeaderStore

func (mc *Cluster) AddLeaderStore(storeID uint64, leaderCount int, leaderSizes ...int64)

AddLeaderStore adds store with specified count of leader.

func (*Cluster) AddRegionStore

func (mc *Cluster) AddRegionStore(storeID uint64, regionCount int)

AddRegionStore adds store with specified count of region.

func (*Cluster) AddRegionStoreWithLeader added in v3.1.0

func (mc *Cluster) AddRegionStoreWithLeader(storeID uint64, regionCount int, leaderCounts ...int)

AddRegionStoreWithLeader adds store with specified count of region and leader.

func (*Cluster) AllocID added in v3.1.0

func (mc *Cluster) AllocID() (uint64, error)

AllocID allocs a new unique ID.

func (*Cluster) AllocPeer

func (mc *Cluster) AllocPeer(storeID uint64) (*metapb.Peer, error)

AllocPeer allocs a new peer on a store.

func (*Cluster) CheckLabelProperty

func (mc *Cluster) CheckLabelProperty(typ string, labels []*metapb.StoreLabel) bool

CheckLabelProperty checks label property.

func (*Cluster) FitRegion added in v3.1.0

func (mc *Cluster) FitRegion(region *core.RegionInfo) *placement.RegionFit

FitRegion fits a region to the rules it matches.

func (*Cluster) GetHotRegionScheduleLimit

func (mc *Cluster) GetHotRegionScheduleLimit() uint64

GetHotRegionScheduleLimit mocks method.

func (*Cluster) GetLeaderScheduleLimit

func (mc *Cluster) GetLeaderScheduleLimit() uint64

GetLeaderScheduleLimit mocks method.

func (*Cluster) GetMaxReplicas

func (mc *Cluster) GetMaxReplicas() int

GetMaxReplicas mocks method.

func (*Cluster) GetMergeScheduleLimit

func (mc *Cluster) GetMergeScheduleLimit() uint64

GetMergeScheduleLimit mocks method.

func (*Cluster) GetOpt

func (mc *Cluster) GetOpt() *mockoption.ScheduleOptions

GetOpt mocks method.

func (*Cluster) GetRegionScheduleLimit

func (mc *Cluster) GetRegionScheduleLimit() uint64

GetRegionScheduleLimit mocks method.

func (*Cluster) GetReplicaScheduleLimit

func (mc *Cluster) GetReplicaScheduleLimit() uint64

GetReplicaScheduleLimit mocks method.

func (*Cluster) GetRuleManager added in v3.1.0

func (mc *Cluster) GetRuleManager() *placement.RuleManager

GetRuleManager returns the ruleManager of the cluster.

func (*Cluster) GetStore added in v3.1.0

func (mc *Cluster) GetStore(storeID uint64) *core.StoreInfo

GetStore gets a store with a given store ID.

func (*Cluster) GetStoreRegionCount

func (mc *Cluster) GetStoreRegionCount(storeID uint64) int

GetStoreRegionCount gets region count with a given store.

func (*Cluster) GetStoresStats added in v3.1.0

func (mc *Cluster) GetStoresStats() *statistics.StoresStats

GetStoresStats gets stores statistics.

func (*Cluster) IsRegionHot

func (mc *Cluster) IsRegionHot(region *core.RegionInfo) bool

IsRegionHot checks if the region is hot.

func (*Cluster) LoadRegion

func (mc *Cluster) LoadRegion(regionID uint64, followerIds ...uint64)

LoadRegion puts region info without leader

func (*Cluster) MockRegionInfo added in v3.1.0

func (mc *Cluster) MockRegionInfo(regionID uint64, leaderID uint64,
	followerIDs []uint64, epoch *metapb.RegionEpoch) *core.RegionInfo

MockRegionInfo returns a mock region

func (*Cluster) PutRegionStores

func (mc *Cluster) PutRegionStores(id uint64, stores ...uint64)

PutRegionStores mocks method.

func (*Cluster) PutStoreWithLabels

func (mc *Cluster) PutStoreWithLabels(id uint64, labelPairs ...string)

PutStoreWithLabels mocks method.

func (*Cluster) RandHotRegionFromStore

func (mc *Cluster) RandHotRegionFromStore(store uint64, kind statistics.FlowKind) *core.RegionInfo

RandHotRegionFromStore random picks a hot region in specify store.

func (*Cluster) RegionReadStats

func (mc *Cluster) RegionReadStats() map[uint64][]*statistics.HotPeerStat

RegionReadStats returns hot region's read stats.

func (*Cluster) RegionWriteStats

func (mc *Cluster) RegionWriteStats() map[uint64][]*statistics.HotPeerStat

RegionWriteStats returns hot region's write stats.

func (*Cluster) RemoveScheduler added in v3.1.0

func (mc *Cluster) RemoveScheduler(name string) error

RemoveScheduler mocks method.

func (*Cluster) ScanRegions

func (mc *Cluster) ScanRegions(startKey, endKey []byte, limit int) []*core.RegionInfo

ScanRegions scans region with start key, until number greater than limit.

func (*Cluster) SetStoreBusy

func (mc *Cluster) SetStoreBusy(storeID uint64, busy bool)

SetStoreBusy sets store busy.

func (*Cluster) SetStoreDisconnect

func (mc *Cluster) SetStoreDisconnect(storeID uint64)

SetStoreDisconnect changes a store's state to disconnected.

func (*Cluster) SetStoreDown

func (mc *Cluster) SetStoreDown(storeID uint64)

SetStoreDown sets store down.

func (*Cluster) SetStoreOffline

func (mc *Cluster) SetStoreOffline(storeID uint64)

SetStoreOffline sets store state to be offline.

func (*Cluster) SetStoreUp

func (mc *Cluster) SetStoreUp(storeID uint64)

SetStoreUp sets store state to be up.

func (*Cluster) UpdateLeaderCount

func (mc *Cluster) UpdateLeaderCount(storeID uint64, leaderCount int)

UpdateLeaderCount updates store leader count.

func (*Cluster) UpdatePendingPeerCount

func (mc *Cluster) UpdatePendingPeerCount(storeID uint64, pendingPeerCount int)

UpdatePendingPeerCount updates store pending peer count.

func (*Cluster) UpdateRegionCount

func (mc *Cluster) UpdateRegionCount(storeID uint64, regionCount int)

UpdateRegionCount updates store region count.

func (*Cluster) UpdateSnapshotCount

func (mc *Cluster) UpdateSnapshotCount(storeID uint64, snapshotCount int)

UpdateSnapshotCount updates store snapshot count.

func (*Cluster) UpdateStorageRatio

func (mc *Cluster) UpdateStorageRatio(storeID uint64, usedRatio, availableRatio float64)

UpdateStorageRatio updates store storage ratio count.

func (*Cluster) UpdateStorageReadBytes

func (mc *Cluster) UpdateStorageReadBytes(storeID uint64, bytesRead uint64)

UpdateStorageReadBytes updates store read bytes.

func (*Cluster) UpdateStorageReadKeys added in v3.1.0

func (mc *Cluster) UpdateStorageReadKeys(storeID uint64, keysRead uint64)

UpdateStorageReadKeys updates store read bytes.

func (*Cluster) UpdateStorageReadStats added in v3.1.0

func (mc *Cluster) UpdateStorageReadStats(storeID, bytesWritten, keysWritten uint64)

UpdateStorageReadStats updates store written bytes.

func (*Cluster) UpdateStorageWrittenBytes

func (mc *Cluster) UpdateStorageWrittenBytes(storeID uint64, bytesWritten uint64)

UpdateStorageWrittenBytes updates store written bytes.

func (*Cluster) UpdateStorageWrittenKeys added in v3.1.0

func (mc *Cluster) UpdateStorageWrittenKeys(storeID uint64, keysWritten uint64)

UpdateStorageWrittenKeys updates store written keys.

func (*Cluster) UpdateStorageWrittenStats added in v3.1.0

func (mc *Cluster) UpdateStorageWrittenStats(storeID, bytesWritten, keysWritten uint64)

UpdateStorageWrittenStats updates store written bytes.

func (*Cluster) UpdateStoreLeaderSize

func (mc *Cluster) UpdateStoreLeaderSize(storeID uint64, size int64)

UpdateStoreLeaderSize updates store leader size.

func (*Cluster) UpdateStoreLeaderWeight

func (mc *Cluster) UpdateStoreLeaderWeight(storeID uint64, weight float64)

UpdateStoreLeaderWeight updates store leader weight.

func (*Cluster) UpdateStoreRegionSize

func (mc *Cluster) UpdateStoreRegionSize(storeID uint64, size int64)

UpdateStoreRegionSize updates store region size.

func (*Cluster) UpdateStoreRegionWeight

func (mc *Cluster) UpdateStoreRegionWeight(storeID uint64, weight float64)

UpdateStoreRegionWeight updates store region weight.

func (*Cluster) UpdateStoreStatus

func (mc *Cluster) UpdateStoreStatus(id uint64)

UpdateStoreStatus updates store status.

Jump to

Keyboard shortcuts

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