Documentation ¶
Index ¶
- Constants
- Variables
- func BootstrapWithMultiRegions(cluster testutils.Cluster, splitKeys ...[]byte) (storeID uint64, regionIDs, peerIDs []uint64)
- func BootstrapWithMultiStores(cluster testutils.Cluster, n int) (storeIDs, peerIDs []uint64, regionID uint64, leaderPeer uint64)
- func BootstrapWithSingleStore(cluster testutils.Cluster) (storeID, peerID, regionID uint64)
- func ImageAvailable() bool
- func NewMockStore(options ...MockTiKVStoreOption) (kv.Storage, error)
- type EmbedUnistoreDriver
- type MockTiKVDriver
- type MockTiKVStoreOption
- func WithClientHijacker(hijacker func(tikv.Client) tikv.Client) MockTiKVStoreOption
- func WithClusterInspector(inspector func(testutils.Cluster)) MockTiKVStoreOption
- func WithDDLChecker() MockTiKVStoreOption
- func WithKeyspaceMeta(keyspaceMeta *keyspacepb.KeyspaceMeta) MockTiKVStoreOption
- func WithMockTiFlash(nodes int) MockTiKVStoreOption
- func WithMultipleOptions(opts ...MockTiKVStoreOption) MockTiKVStoreOption
- func WithPDAddr(addr []string) MockTiKVStoreOption
- func WithPDClientHijacker(hijacker func(pd.Client) pd.Client) MockTiKVStoreOption
- func WithPath(path string) MockTiKVStoreOption
- func WithStoreType(tp StoreType) MockTiKVStoreOption
- func WithTiKVOptions(opts ...tikv.Option) MockTiKVStoreOption
- func WithTxnLocalLatches(capacity uint) MockTiKVStoreOption
- type StoreType
Constants ¶
const ImageFilePath = "/tmp/tidb-unistore-bootstraped-image/"
ImageFilePath is used by testing, it's the file path for the bootstraped store image.
Variables ¶
var DDLCheckerInjector func(kv.Storage) kv.Storage
DDLCheckerInjector is used to break import cycle.
Functions ¶
func BootstrapWithMultiRegions ¶
func BootstrapWithMultiRegions(cluster testutils.Cluster, splitKeys ...[]byte) (storeID uint64, regionIDs, peerIDs []uint64)
BootstrapWithMultiRegions initializes a Cluster with multiple Regions and 1 Store. The number of Regions will be len(splitKeys) + 1.
func BootstrapWithMultiStores ¶
func BootstrapWithMultiStores(cluster testutils.Cluster, n int) (storeIDs, peerIDs []uint64, regionID uint64, leaderPeer uint64)
BootstrapWithMultiStores initializes a Cluster with 1 Region and n Stores.
func BootstrapWithSingleStore ¶
BootstrapWithSingleStore initializes a Cluster with 1 Region and 1 Store.
func ImageAvailable ¶
func ImageAvailable() bool
ImageAvailable checks whether the store image file is available.
func NewMockStore ¶
func NewMockStore(options ...MockTiKVStoreOption) (kv.Storage, error)
NewMockStore creates a mocked tikv store, the path is the file path to store the data. If path is an empty string, a memory storage will be created.
Types ¶
type EmbedUnistoreDriver ¶
type EmbedUnistoreDriver struct{}
EmbedUnistoreDriver is in embedded unistore driver.
type MockTiKVStoreOption ¶
type MockTiKVStoreOption func(*mockOptions)
MockTiKVStoreOption is used to control some behavior of mock tikv.
func WithClientHijacker ¶
func WithClientHijacker(hijacker func(tikv.Client) tikv.Client) MockTiKVStoreOption
WithClientHijacker hijacks KV client's behavior, makes it easy to simulate the network problem between TiDB and TiKV.
func WithClusterInspector ¶
func WithClusterInspector(inspector func(testutils.Cluster)) MockTiKVStoreOption
WithClusterInspector lets user to inspect the mock cluster handler.
func WithDDLChecker ¶
func WithDDLChecker() MockTiKVStoreOption
WithDDLChecker prepare injected DDL implementation for the domain of this store. It must be done before bootstrap to avoid data race with dom.ddl.
func WithKeyspaceMeta ¶
func WithKeyspaceMeta(keyspaceMeta *keyspacepb.KeyspaceMeta) MockTiKVStoreOption
WithKeyspaceMeta lets user set the keyspace meta.
func WithMockTiFlash ¶
func WithMockTiFlash(nodes int) MockTiKVStoreOption
WithMockTiFlash sets the mockStore to have N TiFlash stores (naming as tiflash0, tiflash1, ...).
func WithMultipleOptions ¶
func WithMultipleOptions(opts ...MockTiKVStoreOption) MockTiKVStoreOption
WithMultipleOptions merges multiple options into one option.
func WithPDAddr ¶
func WithPDAddr(addr []string) MockTiKVStoreOption
WithPDAddr set pd address for pd service discovery in mock PD client.
func WithPDClientHijacker ¶
func WithPDClientHijacker(hijacker func(pd.Client) pd.Client) MockTiKVStoreOption
WithPDClientHijacker hijacks PD client's behavior, makes it easy to simulate the network problem between TiDB and PD.
func WithPath ¶
func WithPath(path string) MockTiKVStoreOption
WithPath specifies the mocktikv path.
func WithStoreType ¶
func WithStoreType(tp StoreType) MockTiKVStoreOption
WithStoreType lets user choose the backend storage's type.
func WithTiKVOptions ¶
func WithTiKVOptions(opts ...tikv.Option) MockTiKVStoreOption
WithTiKVOptions sets KV options.
func WithTxnLocalLatches ¶
func WithTxnLocalLatches(capacity uint) MockTiKVStoreOption
WithTxnLocalLatches enable txnLocalLatches, when capacity > 0.