cluster

package
v2.0.0-...-439aceb Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

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