tidb: github.com/pingcap/tidb/util/mock Index | Files

package mock

import "github.com/pingcap/tidb/util/mock"

Package mock is just for test only.

Index

Package Files

client.go context.go store.go

type Client Uses

type Client struct {
    kv.RequestTypeSupportedChecker
    MockResponse kv.Response
}

Client implement kv.Client interface, mocked from "CopClient" defined in "store/tikv/copprocessor.go".

func (*Client) Send Uses

func (c *Client) Send(ctx context.Context, req *kv.Request, kv *kv.Variables) kv.Response

Send implement kv.Client interface.

type Context Uses

type Context struct {
    Store kv.Storage // mock global variable
    // contains filtered or unexported fields
}

Context represents mocked sessionctx.Context.

func NewContext Uses

func NewContext() *Context

NewContext creates a new mocked sessionctx.Context.

func (*Context) AddTableLock Uses

func (c *Context) AddTableLock(_ []model.TableLockTpInfo)

AddTableLock implements the sessionctx.Context interface.

func (*Context) Cancel Uses

func (c *Context) Cancel()

Cancel implements the Session interface.

func (*Context) CheckTableLocked Uses

func (c *Context) CheckTableLocked(_ int64) (bool, model.TableLockType)

CheckTableLocked implements the sessionctx.Context interface.

func (*Context) ClearValue Uses

func (c *Context) ClearValue(key fmt.Stringer)

ClearValue implements sessionctx.Context ClearValue interface.

func (*Context) Close Uses

func (c *Context) Close()

Close implements the sessionctx.Context interface.

func (*Context) DDLOwnerChecker Uses

func (c *Context) DDLOwnerChecker() owner.DDLOwnerChecker

DDLOwnerChecker returns owner.DDLOwnerChecker.

func (*Context) Execute Uses

func (c *Context) Execute(ctx context.Context, sql string) ([]sqlexec.RecordSet, error)

Execute implements sqlexec.SQLExecutor Execute interface.

func (*Context) GetAllTableLocks Uses

func (c *Context) GetAllTableLocks() []model.TableLockTpInfo

GetAllTableLocks implements the sessionctx.Context interface.

func (*Context) GetClient Uses

func (c *Context) GetClient() kv.Client

GetClient implements sessionctx.Context GetClient interface.

func (*Context) GetGlobalSysVar Uses

func (c *Context) GetGlobalSysVar(ctx sessionctx.Context, name string) (string, error)

GetGlobalSysVar implements GlobalVarAccessor GetGlobalSysVar interface.

func (*Context) GetSessionManager Uses

func (c *Context) GetSessionManager() util.SessionManager

GetSessionManager implements the sessionctx.Context interface.

func (*Context) GetSessionVars Uses

func (c *Context) GetSessionVars() *variable.SessionVars

GetSessionVars implements the sessionctx.Context GetSessionVars interface.

func (*Context) GetStore Uses

func (c *Context) GetStore() kv.Storage

GetStore gets the store of session.

func (*Context) GoCtx Uses

func (c *Context) GoCtx() context.Context

GoCtx returns standard sessionctx.Context that bind with current transaction.

func (*Context) HasLockedTables Uses

func (c *Context) HasLockedTables() bool

HasLockedTables implements the sessionctx.Context interface.

func (*Context) InitTxnWithStartTS Uses

func (c *Context) InitTxnWithStartTS(startTS uint64) error

InitTxnWithStartTS implements the sessionctx.Context interface with startTS.

func (*Context) NewTxn Uses

func (c *Context) NewTxn(context.Context) error

NewTxn implements the sessionctx.Context interface.

func (*Context) PreparedPlanCache Uses

func (c *Context) PreparedPlanCache() *kvcache.SimpleLRUCache

PreparedPlanCache implements the sessionctx.Context interface.

func (*Context) RefreshTxnCtx Uses

func (c *Context) RefreshTxnCtx(ctx context.Context) error

RefreshTxnCtx implements the sessionctx.Context interface.

func (*Context) ReleaseAllTableLocks Uses

func (c *Context) ReleaseAllTableLocks()

ReleaseAllTableLocks implements the sessionctx.Context interface.

func (*Context) ReleaseTableLockByTableIDs Uses

func (c *Context) ReleaseTableLockByTableIDs(tableIDs []int64)

ReleaseTableLockByTableIDs implements the sessionctx.Context interface.

func (*Context) ReleaseTableLocks Uses

func (c *Context) ReleaseTableLocks(locks []model.TableLockTpInfo)

ReleaseTableLocks implements the sessionctx.Context interface.

func (*Context) SetGlobalSysVar Uses

func (c *Context) SetGlobalSysVar(ctx sessionctx.Context, name string, value string) error

SetGlobalSysVar implements GlobalVarAccessor SetGlobalSysVar interface.

func (*Context) SetSessionManager Uses

func (c *Context) SetSessionManager(sm util.SessionManager)

SetSessionManager set the session manager.

func (*Context) SetValue Uses

func (c *Context) SetValue(key fmt.Stringer, value interface{})

SetValue implements sessionctx.Context SetValue interface.

func (*Context) StmtAddDirtyTableOP Uses

func (c *Context) StmtAddDirtyTableOP(op int, tid int64, handle int64, row []types.Datum)

StmtAddDirtyTableOP implements the sessionctx.Context interface.

func (*Context) StmtCommit Uses

func (c *Context) StmtCommit() error

StmtCommit implements the sessionctx.Context interface.

func (*Context) StmtGetMutation Uses

func (c *Context) StmtGetMutation(tableID int64) *binlog.TableMutation

StmtGetMutation implements the sessionctx.Context interface.

func (*Context) StmtRollback Uses

func (c *Context) StmtRollback()

StmtRollback implements the sessionctx.Context interface.

func (*Context) StoreQueryFeedback Uses

func (c *Context) StoreQueryFeedback(_ interface{})

StoreQueryFeedback stores the query feedback.

func (*Context) Txn Uses

func (c *Context) Txn(bool) (kv.Transaction, error)

Txn implements sessionctx.Context Txn interface.

func (*Context) Value Uses

func (c *Context) Value(key fmt.Stringer) interface{}

Value implements sessionctx.Context Value interface.

type HookKeyForTest Uses

type HookKeyForTest string

HookKeyForTest is as alias, used by context.WithValue. golint forbits using string type as key in context.WithValue.

type Store Uses

type Store struct {
    Client kv.Client
}

Store implements kv.Storage interface.

func (*Store) Begin Uses

func (s *Store) Begin() (kv.Transaction, error)

Begin implements kv.Storage interface.

func (*Store) BeginWithStartTS Uses

func (s *Store) BeginWithStartTS(startTS uint64) (kv.Transaction, error)

BeginWithStartTS implements kv.Storage interface.

func (*Store) Close Uses

func (s *Store) Close() error

Close implements kv.Storage interface.

func (*Store) CurrentVersion Uses

func (s *Store) CurrentVersion() (kv.Version, error)

CurrentVersion implements kv.Storage interface.

func (*Store) Describe Uses

func (s *Store) Describe() string

Describe implements kv.Storage interface.

func (*Store) GetClient Uses

func (s *Store) GetClient() kv.Client

GetClient implements kv.Storage interface.

func (*Store) GetOracle Uses

func (s *Store) GetOracle() oracle.Oracle

GetOracle implements kv.Storage interface.

func (*Store) GetSnapshot Uses

func (s *Store) GetSnapshot(ver kv.Version) (kv.Snapshot, error)

GetSnapshot implements kv.Storage interface.

func (*Store) Name Uses

func (s *Store) Name() string

Name implements kv.Storage interface.

func (*Store) ShowStatus Uses

func (s *Store) ShowStatus(ctx context.Context, key string) (interface{}, error)

ShowStatus implements kv.Storage interface.

func (*Store) SupportDeleteRange Uses

func (s *Store) SupportDeleteRange() bool

SupportDeleteRange implements kv.Storage interface.

func (*Store) UUID Uses

func (s *Store) UUID() string

UUID implements kv.Storage interface.

Package mock imports 16 packages (graph) and is imported by 48 packages. Updated 2019-08-13. Refresh now. Tools for package owners.