mockcluster

package
v0.0.0-...-1338f1b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

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) AddLeaderRegion

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

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

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) AllocPeer

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

AllocPeer allocs a new peer on a store.

func (*Cluster) GetLeaderScheduleLimit

func (mc *Cluster) GetLeaderScheduleLimit() uint64

GetLeaderScheduleLimit mocks method.

func (*Cluster) GetMaxReplicas

func (mc *Cluster) GetMaxReplicas() int

GetMaxReplicas 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) GetStore

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) LoadRegion

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

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

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

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

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) 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