Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface {
// AllocID creates an unique ID in cluster. The ID could be used as either
// StoreID, RegionID, or PeerID.
AllocID() uint64
// GetRegionByKey returns the Region, Buckets and its leader whose range contains the key.
GetRegionByKey(key []byte) (*metapb.Region, *metapb.Peer, *metapb.Buckets)
// GetAllStores returns all Stores' meta.
GetAllStores() []*metapb.Store
// ScheduleDelay schedules a delay event for a transaction on a region.
ScheduleDelay(startTS, regionID uint64, dur time.Duration)
// Split splits a Region at the key (encoded) and creates new Region.
Split(regionID, newRegionID uint64, key []byte, peerIDs []uint64, leaderPeerID uint64)
// SplitRaw splits a Region at the key (not encoded) and creates new Region.
SplitRaw(regionID, newRegionID uint64, rawKey []byte, peerIDs []uint64, leaderPeerID uint64) *metapb.Region
// SplitKeys evenly splits the start, end key into "count" regions.
SplitKeys(start, end []byte, count int)
// AddStore adds a new Store to the cluster.
AddStore(storeID uint64, addr string, labels ...*metapb.StoreLabel)
// RemoveStore removes a Store from the cluster.
RemoveStore(storeID uint64)
}
Cluster simulates a TiKV cluster. It can be used to change cluster states in tests.
Click to show internal directories.
Click to hide internal directories.