Documentation ¶
Overview ¶
Package mock is just for test only.
Index ¶
- Variables
- type Client
- type Context
- func (*Context) AddTableLock(_ []model.TableLockTpInfo)
- func (*Context) BuiltinFunctionUsageInc(_ string)
- func (c *Context) Cancel()
- func (*Context) CheckTableLocked(_ int64) (bool, model.TableLockType)
- func (c *Context) ClearDiskFullOpt()
- func (c *Context) ClearValue(key fmt.Stringer)
- func (*Context) Close()
- func (c *Context) CommitTxn(ctx context.Context) error
- func (*Context) DecodeSessionStates(context.Context, sessionctx.Context, *sessionstates.SessionStates) error
- func (c *Context) DisableSandBoxMode()
- func (c *Context) EnableSandBoxMode()
- func (*Context) EncodeSessionStates(context.Context, sessionctx.Context, *sessionstates.SessionStates) error
- func (*Context) Execute(_ context.Context, _ string) ([]sqlexec.RecordSet, error)
- func (*Context) ExecuteInternal(_ context.Context, _ string, _ ...interface{}) (sqlexec.RecordSet, error)
- func (*Context) ExecuteStmt(_ context.Context, _ ast.StmtNode) (sqlexec.RecordSet, error)
- func (*Context) GetAdvisoryLock(_ string, _ int64) error
- func (*Context) GetAllTableLocks() []model.TableLockTpInfo
- func (*Context) GetBuiltinFunctionUsage() map[string]uint32
- func (c *Context) GetClient() kv.Client
- func (c *Context) GetDomainInfoSchema() sessionctx.InfoschemaMetaVersion
- func (*Context) GetExtensions() *extension.SessionExtensions
- func (*Context) GetGlobalSysVar(_ sessionctx.Context, name string) (string, error)
- func (c *Context) GetInfoSchema() sessionctx.InfoschemaMetaVersion
- func (c *Context) GetMPPClient() kv.MPPClient
- func (c *Context) GetPlanCache(_ bool) sessionctx.PlanCache
- func (c *Context) GetPreparedTxnFuture() sessionctx.TxnFuture
- func (c *Context) GetSessionManager() util.SessionManager
- func (c *Context) GetSessionVars() *variable.SessionVars
- func (*Context) GetStmtStats() *stmtstats.StatementStats
- func (c *Context) GetStore() kv.Storage
- func (*Context) GetTxnWriteThroughputSLI() *sli.TxnWriteThroughputSLI
- func (c *Context) GoCtx() context.Context
- func (*Context) HasDirtyContent(_ int64) bool
- func (*Context) HasLockedTables() bool
- func (c *Context) InSandBoxMode() bool
- func (*Context) IsDDLOwner() bool
- func (c *Context) NewStaleTxnWithStartTS(ctx context.Context, _ uint64) error
- func (c *Context) NewTxn(context.Context) error
- func (c *Context) PrepareTSFuture(_ context.Context, future oracle.Future, _ string) error
- func (c *Context) RefreshTxnCtx(ctx context.Context) error
- func (*Context) RefreshVars(_ context.Context) error
- func (*Context) ReleaseAdvisoryLock(_ string) bool
- func (*Context) ReleaseAllAdvisoryLocks() int
- func (*Context) ReleaseAllTableLocks()
- func (*Context) ReleaseTableLockByTableIDs(_ []int64)
- func (*Context) ReleaseTableLocks(_ []model.TableLockTpInfo)
- func (c *Context) RollbackTxn(_ context.Context)
- func (c *Context) SetDiskFullOpt(level kvrpcpb.DiskFullOpt)
- func (*Context) SetGlobalSysVar(_ sessionctx.Context, name string, value string) error
- func (c *Context) SetSessionManager(sm util.SessionManager)
- func (c *Context) SetValue(key fmt.Stringer, value interface{})
- func (*Context) ShowProcess() *util.ProcessInfo
- func (*Context) StmtCommit(context.Context)
- func (*Context) StmtGetMutation(_ int64) *binlog.TableMutation
- func (*Context) StmtRollback(context.Context, bool)
- func (*Context) StoreIndexUsage(_ int64, _ int64, _ int64)
- func (*Context) StoreQueryFeedback(_ interface{})
- func (c *Context) Txn(bool) (kv.Transaction, error)
- func (*Context) UpdateColStatsUsage(_ []model.TableItemID)
- func (c *Context) Value(key fmt.Stringer) interface{}
- type HookKeyForTest
- type MockedIter
- type SliceIter
- type Store
- func (*Store) Begin(_ ...tikv.TxnOption) (kv.Transaction, error)
- func (*Store) Close() error
- func (*Store) CurrentVersion(_ string) (kv.Version, error)
- func (*Store) Describe() string
- func (s *Store) GetClient() kv.Client
- func (*Store) GetCodec() tikv.Codec
- func (*Store) GetLockWaits() ([]*deadlockpb.WaitForEntry, error)
- func (*Store) GetMPPClient() kv.MPPClient
- func (*Store) GetMemCache() kv.MemManager
- func (*Store) GetMinSafeTS(_ string) uint64
- func (*Store) GetOracle() oracle.Oracle
- func (*Store) GetSnapshot(_ kv.Version) kv.Snapshot
- func (*Store) Name() string
- func (*Store) ShowStatus(_ context.Context, _ string) (interface{}, error)
- func (*Store) SupportDeleteRange() bool
- func (*Store) UUID() string
Constants ¶
This section is empty.
Variables ¶
var MockInfoschema func(tbList []*model.TableInfo) sessionctx.InfoschemaMetaVersion
MockInfoschema only serves for test.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { kv.RequestTypeSupportedChecker MockResponse kv.Response }
Client implement kv.Client interface, mocked from "CopClient" defined in "store/tikv/copprocessor.go".
type Context ¶
type Context struct { Store kv.Storage // mock global variable // contains filtered or unexported fields }
Context represents mocked sessionctx.Context.
func (*Context) AddTableLock ¶
func (*Context) AddTableLock(_ []model.TableLockTpInfo)
AddTableLock implements the sessionctx.Context interface.
func (*Context) BuiltinFunctionUsageInc ¶
BuiltinFunctionUsageInc implements sessionctx.Context.
func (*Context) CheckTableLocked ¶
func (*Context) CheckTableLocked(_ int64) (bool, model.TableLockType)
CheckTableLocked implements the sessionctx.Context interface.
func (*Context) ClearDiskFullOpt ¶
func (c *Context) ClearDiskFullOpt()
ClearDiskFullOpt clears allowed options of current operation in each TiKV disk usage level.
func (*Context) ClearValue ¶
ClearValue implements sessionctx.Context ClearValue interface.
func (*Context) DecodeSessionStates ¶
func (*Context) DecodeSessionStates(context.Context, sessionctx.Context, *sessionstates.SessionStates) error
DecodeSessionStates implements sessionctx.Context DecodeSessionStates interface.
func (*Context) DisableSandBoxMode ¶
func (c *Context) DisableSandBoxMode()
DisableSandBoxMode enable the sandbox mode.
func (*Context) EnableSandBoxMode ¶
func (c *Context) EnableSandBoxMode()
EnableSandBoxMode enable the sandbox mode.
func (*Context) EncodeSessionStates ¶
func (*Context) EncodeSessionStates(context.Context, sessionctx.Context, *sessionstates.SessionStates) error
EncodeSessionStates implements sessionctx.Context EncodeSessionStates interface.
func (*Context) ExecuteInternal ¶
func (*Context) ExecuteInternal(_ context.Context, _ string, _ ...interface{}) (sqlexec.RecordSet, error)
ExecuteInternal implements sqlexec.SQLExecutor ExecuteInternal interface.
func (*Context) ExecuteStmt ¶
ExecuteStmt implements sqlexec.SQLExecutor ExecuteStmt interface.
func (*Context) GetAdvisoryLock ¶
GetAdvisoryLock acquires an advisory lock
func (*Context) GetAllTableLocks ¶
func (*Context) GetAllTableLocks() []model.TableLockTpInfo
GetAllTableLocks implements the sessionctx.Context interface.
func (*Context) GetBuiltinFunctionUsage ¶
GetBuiltinFunctionUsage implements sessionctx.Context GetBuiltinFunctionUsage interface.
func (*Context) GetDomainInfoSchema ¶
func (c *Context) GetDomainInfoSchema() sessionctx.InfoschemaMetaVersion
GetDomainInfoSchema returns the latest information schema in domain
func (*Context) GetExtensions ¶
func (*Context) GetExtensions() *extension.SessionExtensions
GetExtensions returns the `*extension.SessionExtensions` object
func (*Context) GetGlobalSysVar ¶
GetGlobalSysVar implements GlobalVarAccessor GetGlobalSysVar interface.
func (*Context) GetInfoSchema ¶
func (c *Context) GetInfoSchema() sessionctx.InfoschemaMetaVersion
GetInfoSchema implements sessionctx.Context GetInfoSchema interface.
func (*Context) GetMPPClient ¶
GetMPPClient implements sessionctx.Context GetMPPClient interface.
func (*Context) GetPlanCache ¶
func (c *Context) GetPlanCache(_ bool) sessionctx.PlanCache
GetPlanCache implements the sessionctx.Context interface.
func (*Context) GetPreparedTxnFuture ¶
func (c *Context) GetPreparedTxnFuture() sessionctx.TxnFuture
GetPreparedTxnFuture returns the TxnFuture if it is prepared. It returns nil otherwise.
func (*Context) GetSessionManager ¶
func (c *Context) GetSessionManager() util.SessionManager
GetSessionManager implements the sessionctx.Context interface.
func (*Context) GetSessionVars ¶
func (c *Context) GetSessionVars() *variable.SessionVars
GetSessionVars implements the sessionctx.Context GetSessionVars interface.
func (*Context) GetStmtStats ¶
func (*Context) GetStmtStats() *stmtstats.StatementStats
GetStmtStats implements the sessionctx.Context interface.
func (*Context) GetTxnWriteThroughputSLI ¶
func (*Context) GetTxnWriteThroughputSLI() *sli.TxnWriteThroughputSLI
GetTxnWriteThroughputSLI implements the sessionctx.Context interface.
func (*Context) GoCtx ¶
GoCtx returns standard sessionctx.Context that bind with current transaction.
func (*Context) HasDirtyContent ¶
HasDirtyContent implements sessionctx.Context ClearValue interface.
func (*Context) HasLockedTables ¶
HasLockedTables implements the sessionctx.Context interface.
func (*Context) InSandBoxMode ¶
InSandBoxMode indicates that this Session is in sandbox mode
func (*Context) IsDDLOwner ¶
IsDDLOwner checks whether this session is DDL owner.
func (*Context) NewStaleTxnWithStartTS ¶
NewStaleTxnWithStartTS implements the sessionctx.Context interface.
func (*Context) PrepareTSFuture ¶
PrepareTSFuture implements the sessionctx.Context interface.
func (*Context) RefreshTxnCtx ¶
RefreshTxnCtx implements the sessionctx.Context interface.
func (*Context) RefreshVars ¶
RefreshVars implements the sessionctx.Context interface.
func (*Context) ReleaseAdvisoryLock ¶
ReleaseAdvisoryLock releases an advisory lock
func (*Context) ReleaseAllAdvisoryLocks ¶
ReleaseAllAdvisoryLocks releases all advisory locks
func (*Context) ReleaseAllTableLocks ¶
func (*Context) ReleaseAllTableLocks()
ReleaseAllTableLocks implements the sessionctx.Context interface.
func (*Context) ReleaseTableLockByTableIDs ¶
ReleaseTableLockByTableIDs implements the sessionctx.Context interface.
func (*Context) ReleaseTableLocks ¶
func (*Context) ReleaseTableLocks(_ []model.TableLockTpInfo)
ReleaseTableLocks implements the sessionctx.Context interface.
func (*Context) RollbackTxn ¶
RollbackTxn indicates an expected call of RollbackTxn.
func (*Context) SetDiskFullOpt ¶
func (c *Context) SetDiskFullOpt(level kvrpcpb.DiskFullOpt)
SetDiskFullOpt sets allowed options of current operation in each TiKV disk usage level.
func (*Context) SetGlobalSysVar ¶
SetGlobalSysVar implements GlobalVarAccessor SetGlobalSysVar interface.
func (*Context) SetSessionManager ¶
func (c *Context) SetSessionManager(sm util.SessionManager)
SetSessionManager set the session manager.
func (*Context) ShowProcess ¶
func (*Context) ShowProcess() *util.ProcessInfo
ShowProcess implements sessionctx.Context ShowProcess interface.
func (*Context) StmtCommit ¶
StmtCommit implements the sessionctx.Context interface.
func (*Context) StmtGetMutation ¶
StmtGetMutation implements the sessionctx.Context interface.
func (*Context) StmtRollback ¶
StmtRollback implements the sessionctx.Context interface.
func (*Context) StoreIndexUsage ¶
StoreIndexUsage strores the index usage information.
func (*Context) StoreQueryFeedback ¶
func (*Context) StoreQueryFeedback(_ interface{})
StoreQueryFeedback stores the query feedback.
func (*Context) Txn ¶
func (c *Context) Txn(bool) (kv.Transaction, error)
Txn implements sessionctx.Context Txn interface.
func (*Context) UpdateColStatsUsage ¶
func (*Context) UpdateColStatsUsage(_ []model.TableItemID)
UpdateColStatsUsage updates the column stats usage.
type HookKeyForTest ¶
type HookKeyForTest string
HookKeyForTest is as alias, used by context.WithValue. golint forbits using string type as key in context.WithValue.
type MockedIter ¶
MockedIter is a mocked iter for test
func NewMockIterFromRecords ¶
NewMockIterFromRecords creates a new MockedIter
func (*MockedIter) FailOnMultiClose ¶
func (i *MockedIter) FailOnMultiClose(fail bool)
FailOnMultiClose set if should fail when Close is invoked more than once
func (*MockedIter) GetInjectedNextError ¶
func (i *MockedIter) GetInjectedNextError() error
GetInjectedNextError get the injected error
func (*MockedIter) InjectNextError ¶
func (i *MockedIter) InjectNextError(err error)
InjectNextError injects error to its Next
type SliceIter ¶
type SliceIter struct {
// contains filtered or unexported fields
}
SliceIter is used to iterate slice
func NewSliceIter ¶
NewSliceIter creates a new SliceIter
type Store ¶
Store implements kv.Storage interface.
func (*Store) CurrentVersion ¶
CurrentVersion implements kv.Storage interface.
func (*Store) GetLockWaits ¶
func (*Store) GetLockWaits() ([]*deadlockpb.WaitForEntry, error)
GetLockWaits implements kv.Storage interface.
func (*Store) GetMPPClient ¶
GetMPPClient implements kv.Storage interface.
func (*Store) GetMemCache ¶
func (*Store) GetMemCache() kv.MemManager
GetMemCache implements kv.Storage interface
func (*Store) GetMinSafeTS ¶
GetMinSafeTS implements kv.Storage interface.
func (*Store) GetSnapshot ¶
GetSnapshot implements kv.Storage interface.
func (*Store) ShowStatus ¶
ShowStatus implements kv.Storage interface.
func (*Store) SupportDeleteRange ¶
SupportDeleteRange implements kv.Storage interface.