tidb: github.com/pingcap/tidb/store/mockstore Index | Files | Directories

package mockstore

import "github.com/pingcap/tidb/store/mockstore"

Index

Package Files

mockstore.go tikv.go unistore.go

func BootstrapWithMultiRegions Uses

func BootstrapWithMultiRegions(cluster cluster.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 Uses

func BootstrapWithMultiStores(cluster cluster.Cluster, n int) (storeIDs, peerIDs []uint64, regionID uint64, leaderPeer uint64)

BootstrapWithMultiStores initializes a Cluster with 1 Region and n Stores.

func BootstrapWithSingleStore Uses

func BootstrapWithSingleStore(cluster cluster.Cluster) (storeID, peerID, regionID uint64)

BootstrapWithSingleStore initializes a Cluster with 1 Region and 1 Store.

func NewMockStore Uses

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.

type EmbedUnistoreDriver Uses

type EmbedUnistoreDriver struct{}

EmbedUnistoreDriver is in embedded unistore driver.

func (EmbedUnistoreDriver) Open Uses

func (d EmbedUnistoreDriver) Open(path string) (kv.Storage, error)

Open creates a EmbedUnistore storage.

type MockTiKVDriver Uses

type MockTiKVDriver struct{}

MockTiKVDriver is in memory mock TiKV driver.

func (MockTiKVDriver) Open Uses

func (d MockTiKVDriver) Open(path string) (kv.Storage, error)

Open creates a MockTiKV storage.

type MockTiKVStoreOption Uses

type MockTiKVStoreOption func(*mockOptions)

MockTiKVStoreOption is used to control some behavior of mock tikv.

func WithClientHijacker Uses

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 Uses

func WithClusterInspector(inspector func(cluster.Cluster)) MockTiKVStoreOption

WithClusterInspector lets user to inspect the mock cluster handler.

func WithPDClientHijacker Uses

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 Uses

func WithPath(path string) MockTiKVStoreOption

WithPath specifies the mocktikv path.

func WithStoreType Uses

func WithStoreType(tp StoreType) MockTiKVStoreOption

WithStoreType lets user choose the backend storage's type.

func WithTxnLocalLatches Uses

func WithTxnLocalLatches(capacity uint) MockTiKVStoreOption

WithTxnLocalLatches enable txnLocalLatches, when capacity > 0.

type StoreType Uses

type StoreType uint8

StoreType is the type of backend mock storage.

const (
    // MockTiKV is the mock storage based on goleveldb.
    MockTiKV StoreType = iota
    // EmbedUnistore is the mock storage based on unistore.
    EmbedUnistore
)

Directories

PathSynopsis
cluster
mocktikv

Package mockstore imports 10 packages (graph) and is imported by 38 packages. Updated 2020-05-30. Refresh now. Tools for package owners.