Documentation ¶
Index ¶
- type Cluster
- func (mc *Cluster) AddLabelsStore(storeID uint64, regionCount int, labels map[string]string)
- func (mc *Cluster) AddLeaderRegion(regionID uint64, leaderID uint64, followerIds ...uint64) *core.RegionInfo
- func (mc *Cluster) AddLeaderRegionWithRange(regionID uint64, startKey string, endKey string, leaderID uint64, ...)
- func (mc *Cluster) AddLeaderRegionWithReadInfo(regionID uint64, leaderID uint64, readBytes, readKeys uint64, ...)
- func (mc *Cluster) AddLeaderRegionWithWriteInfo(regionID uint64, leaderID uint64, writtenBytes, writtenKeys uint64, ...)
- func (mc *Cluster) AddLeaderStore(storeID uint64, leaderCount int, leaderSizes ...int64)
- func (mc *Cluster) AddRegionStore(storeID uint64, regionCount int)
- func (mc *Cluster) AddRegionStoreWithLeader(storeID uint64, regionCount int, leaderCounts ...int)
- func (mc *Cluster) AllocID() (uint64, error)
- func (mc *Cluster) AllocPeer(storeID uint64) (*metapb.Peer, error)
- func (mc *Cluster) CheckLabelProperty(typ string, labels []*metapb.StoreLabel) bool
- func (mc *Cluster) FitRegion(region *core.RegionInfo) *placement.RegionFit
- func (mc *Cluster) GetHotRegionScheduleLimit() uint64
- func (mc *Cluster) GetLeaderScheduleLimit() uint64
- func (mc *Cluster) GetMaxReplicas() int
- func (mc *Cluster) GetMergeScheduleLimit() uint64
- func (mc *Cluster) GetOpt() *mockoption.ScheduleOptions
- func (mc *Cluster) GetRegionScheduleLimit() uint64
- func (mc *Cluster) GetReplicaScheduleLimit() uint64
- func (mc *Cluster) GetRuleManager() *placement.RuleManager
- func (mc *Cluster) GetStore(storeID uint64) *core.StoreInfo
- func (mc *Cluster) GetStoreRegionCount(storeID uint64) int
- func (mc *Cluster) GetStoresStats() *statistics.StoresStats
- func (mc *Cluster) IsRegionHot(region *core.RegionInfo) bool
- func (mc *Cluster) LoadRegion(regionID uint64, followerIds ...uint64)
- func (mc *Cluster) MockRegionInfo(regionID uint64, leaderID uint64, followerIDs []uint64, ...) *core.RegionInfo
- func (mc *Cluster) PutRegionStores(id uint64, stores ...uint64)
- func (mc *Cluster) PutStoreWithLabels(id uint64, labelPairs ...string)
- func (mc *Cluster) RandHotRegionFromStore(store uint64, kind statistics.FlowKind) *core.RegionInfo
- func (mc *Cluster) RegionReadStats() map[uint64][]*statistics.HotPeerStat
- func (mc *Cluster) RegionWriteStats() map[uint64][]*statistics.HotPeerStat
- func (mc *Cluster) RemoveScheduler(name string) error
- func (mc *Cluster) ScanRegions(startKey, endKey []byte, limit int) []*core.RegionInfo
- func (mc *Cluster) SetStoreBusy(storeID uint64, busy bool)
- func (mc *Cluster) SetStoreDisconnect(storeID uint64)
- func (mc *Cluster) SetStoreDown(storeID uint64)
- func (mc *Cluster) SetStoreOffline(storeID uint64)
- func (mc *Cluster) SetStoreUp(storeID uint64)
- func (mc *Cluster) UpdateLeaderCount(storeID uint64, leaderCount int)
- func (mc *Cluster) UpdatePendingPeerCount(storeID uint64, pendingPeerCount int)
- func (mc *Cluster) UpdateRegionCount(storeID uint64, regionCount int)
- func (mc *Cluster) UpdateSnapshotCount(storeID uint64, snapshotCount int)
- func (mc *Cluster) UpdateStorageRatio(storeID uint64, usedRatio, availableRatio float64)
- func (mc *Cluster) UpdateStorageReadBytes(storeID uint64, bytesRead uint64)
- func (mc *Cluster) UpdateStorageReadKeys(storeID uint64, keysRead uint64)
- func (mc *Cluster) UpdateStorageReadStats(storeID, bytesWritten, keysWritten uint64)
- func (mc *Cluster) UpdateStorageWrittenBytes(storeID uint64, bytesWritten uint64)
- func (mc *Cluster) UpdateStorageWrittenKeys(storeID uint64, keysWritten uint64)
- func (mc *Cluster) UpdateStorageWrittenStats(storeID, bytesWritten, keysWritten uint64)
- func (mc *Cluster) UpdateStoreLeaderSize(storeID uint64, size int64)
- func (mc *Cluster) UpdateStoreLeaderWeight(storeID uint64, weight float64)
- func (mc *Cluster) UpdateStoreRegionSize(storeID uint64, size int64)
- func (mc *Cluster) UpdateStoreRegionWeight(storeID uint64, weight float64)
- func (mc *Cluster) UpdateStoreStatus(id uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { *core.BasicCluster *mockid.IDAllocator *mockoption.ScheduleOptions *placement.RuleManager *statistics.HotCache *statistics.StoresStats ID uint64 }
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 ¶
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 ¶
AddLeaderStore adds store with specified count of leader.
func (*Cluster) AddRegionStore ¶
AddRegionStore adds store with specified count of region.
func (*Cluster) AddRegionStoreWithLeader ¶ added in v3.1.0
AddRegionStoreWithLeader adds store with specified count of region and leader.
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 ¶
GetHotRegionScheduleLimit mocks method.
func (*Cluster) GetLeaderScheduleLimit ¶
GetLeaderScheduleLimit mocks method.
func (*Cluster) GetMaxReplicas ¶
GetMaxReplicas mocks method.
func (*Cluster) GetMergeScheduleLimit ¶
GetMergeScheduleLimit mocks method.
func (*Cluster) GetOpt ¶
func (mc *Cluster) GetOpt() *mockoption.ScheduleOptions
GetOpt mocks method.
func (*Cluster) GetRegionScheduleLimit ¶
GetRegionScheduleLimit mocks method.
func (*Cluster) GetReplicaScheduleLimit ¶
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) GetStoreRegionCount ¶
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 ¶
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 ¶
PutRegionStores mocks method.
func (*Cluster) PutStoreWithLabels ¶
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
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 ¶
SetStoreBusy sets store busy.
func (*Cluster) SetStoreDisconnect ¶
SetStoreDisconnect changes a store's state to disconnected.
func (*Cluster) SetStoreDown ¶
SetStoreDown sets store down.
func (*Cluster) SetStoreOffline ¶
SetStoreOffline sets store state to be offline.
func (*Cluster) SetStoreUp ¶
SetStoreUp sets store state to be up.
func (*Cluster) UpdateLeaderCount ¶
UpdateLeaderCount updates store leader count.
func (*Cluster) UpdatePendingPeerCount ¶
UpdatePendingPeerCount updates store pending peer count.
func (*Cluster) UpdateRegionCount ¶
UpdateRegionCount updates store region count.
func (*Cluster) UpdateSnapshotCount ¶
UpdateSnapshotCount updates store snapshot count.
func (*Cluster) UpdateStorageRatio ¶
UpdateStorageRatio updates store storage ratio count.
func (*Cluster) UpdateStorageReadBytes ¶
UpdateStorageReadBytes updates store read bytes.
func (*Cluster) UpdateStorageReadKeys ¶ added in v3.1.0
UpdateStorageReadKeys updates store read bytes.
func (*Cluster) UpdateStorageReadStats ¶ added in v3.1.0
UpdateStorageReadStats updates store written bytes.
func (*Cluster) UpdateStorageWrittenBytes ¶
UpdateStorageWrittenBytes updates store written bytes.
func (*Cluster) UpdateStorageWrittenKeys ¶ added in v3.1.0
UpdateStorageWrittenKeys updates store written keys.
func (*Cluster) UpdateStorageWrittenStats ¶ added in v3.1.0
UpdateStorageWrittenStats updates store written bytes.
func (*Cluster) UpdateStoreLeaderSize ¶
UpdateStoreLeaderSize updates store leader size.
func (*Cluster) UpdateStoreLeaderWeight ¶
UpdateStoreLeaderWeight updates store leader weight.
func (*Cluster) UpdateStoreRegionSize ¶
UpdateStoreRegionSize updates store region size.
func (*Cluster) UpdateStoreRegionWeight ¶
UpdateStoreRegionWeight updates store region weight.
func (*Cluster) UpdateStoreStatus ¶
UpdateStoreStatus updates store status.