Documentation ¶
Index ¶
- type Cluster
- func (mc *Cluster) AddLeaderRegion(regionID uint64, leaderID uint64, followerIds ...uint64)
- func (mc *Cluster) AddLeaderRegionWithRange(regionID uint64, startKey string, endKey string, leaderID uint64, ...)
- func (mc *Cluster) AddLeaderStore(storeID uint64, leaderCount int, leaderSizes ...int64)
- func (mc *Cluster) AddRegionStore(storeID uint64, regionCount int)
- func (mc *Cluster) AllocPeer(storeID uint64) (*metapb.Peer, error)
- func (mc *Cluster) GetLeaderScheduleLimit() uint64
- func (mc *Cluster) GetMaxReplicas() int
- func (mc *Cluster) GetOpt() *mockoption.ScheduleOptions
- func (mc *Cluster) GetRegionScheduleLimit() uint64
- func (mc *Cluster) GetReplicaScheduleLimit() uint64
- func (mc *Cluster) GetStore(storeID uint64) *core.StoreInfo
- func (mc *Cluster) GetStoreRegionCount(storeID uint64) int
- 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) 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) 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 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) AddLeaderRegion ¶
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) AddLeaderStore ¶
AddLeaderStore adds store with specified count of leader.
func (*Cluster) AddRegionStore ¶
AddRegionStore adds store with specified count of region.
func (*Cluster) GetLeaderScheduleLimit ¶
GetLeaderScheduleLimit mocks method.
func (*Cluster) GetMaxReplicas ¶
GetMaxReplicas 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) GetStoreRegionCount ¶
GetStoreRegionCount gets region count with a given store.
func (*Cluster) LoadRegion ¶
LoadRegion puts region info without leader
func (*Cluster) MockRegionInfo ¶
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) 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) 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.