Documentation ¶
Overview ¶
Package runtime is a generated GoMock package.
Index ¶
- Variables
- func NumOfStateBranchTx(state TxState, tx CompositeTx) int32
- func Register(tenant string, schema string, rt Runtime) error
- func Unload(tenant, schema string) error
- type AtomDB
- func (db *AtomDB) Call(ctx context.Context, sql string, args ...proto.Value) (res proto.Result, warn uint16, err error)
- func (db *AtomDB) CallFieldList(ctx context.Context, table, wildcard string) ([]proto.Field, error)
- func (db *AtomDB) Capacity() int
- func (db *AtomDB) Close() error
- func (db *AtomDB) ID() string
- func (db *AtomDB) IdleTimeout() time.Duration
- func (db *AtomDB) MaxCapacity() int
- func (db *AtomDB) NodeConn() proto.NodeConn
- func (db *AtomDB) SetCapacity(capacity int) error
- func (db *AtomDB) SetIdleTimeout(idleTimeout time.Duration) error
- func (db *AtomDB) SetMaxCapacity(maxCapacity int) error
- func (db *AtomDB) SetWeight(weight proto.Weight) error
- func (db *AtomDB) Variable(ctx context.Context, name string) (interface{}, error)
- func (db *AtomDB) Weight() proto.Weight
- type BackendResourcePool
- type BranchTx
- type CompositeTx
- type DeadLockDog
- type MockRuntime
- func (m *MockRuntime) Begin(arg0 context.Context, arg1 ...TxHook) (proto.Tx, error)
- func (m *MockRuntime) EXPECT() *MockRuntimeMockRecorder
- func (m *MockRuntime) Exec(arg0 context.Context, arg1, arg2 string, arg3 ...proto.Value) (proto.Result, error)
- func (m *MockRuntime) Execute(arg0 *proto.Context) (proto.Result, uint16, error)
- func (m *MockRuntime) Namespace() *namespace.Namespace
- func (m *MockRuntime) Query(arg0 context.Context, arg1, arg2 string, arg3 ...proto.Value) (proto.Result, error)
- type MockRuntimeMockRecorder
- func (mr *MockRuntimeMockRecorder) Begin(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockRuntimeMockRecorder) Exec(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call
- func (mr *MockRuntimeMockRecorder) Execute(arg0 interface{}) *gomock.Call
- func (mr *MockRuntimeMockRecorder) Namespace() *gomock.Call
- func (mr *MockRuntimeMockRecorder) Query(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call
- type Runtime
- type TxHook
- type TxState
Constants ¶
This section is empty.
Variables ¶
var Tracer = otel.Tracer("Runtime")
Functions ¶
func NumOfStateBranchTx ¶
func NumOfStateBranchTx(state TxState, tx CompositeTx) int32
Types ¶
type AtomDB ¶
type AtomDB struct {
// contains filtered or unexported fields
}
AtomDB represents an atom physical database instance
func (*AtomDB) CallFieldList ¶
func (*AtomDB) IdleTimeout ¶
func (*AtomDB) MaxCapacity ¶
func (*AtomDB) SetCapacity ¶
func (*AtomDB) SetMaxCapacity ¶
type BackendResourcePool ¶
type BackendResourcePool pools.ResourcePool
func (*BackendResourcePool) Get ¶
func (bcp *BackendResourcePool) Get(ctx context.Context) (*mysql.BackendConnection, error)
Get will return the next available resource and convert to mysql.BackendConnection. If available less than 1, it will make capacity increase by 1. If the net connection check failure, it will take again.
type BranchTx ¶
type BranchTx interface { // SetPrepareFunc sets prepare dbFunc SetPrepareFunc(f dbFunc) // SetCommitFunc sets commit dbFunc SetCommitFunc(f dbFunc) // SetRollbackFunc sets rollback dbFunc SetRollbackFunc(f dbFunc) // GetConn gets mysql connection GetConn() *mysql.BackendConnection // GetTxState get cur tx state GetTxState() TxState // Commit commit tx Commit(ctx context.Context) (res proto.Result, warn uint16, err error) // Rollback rollback tx Rollback(ctx context.Context) (proto.Result, uint16, error) }
BranchTx each atomDB transaction
type CompositeTx ¶
type CompositeTx interface { // GetTrxID get cur tx id GetTrxID() string // GetTenant get cur tx owner tenant GetTenant() string // GetTxState get cur tx state GetTxState() TxState // SetBeginFunc sets begin func SetBeginFunc(f dbFunc) // Range range branchTx map Range(func(tx BranchTx)) // Commit commit tx Commit(ctx context.Context) (res proto.Result, warn uint16, err error) // Rollback rollback tx Rollback(ctx context.Context) (proto.Result, uint16, error) }
CompositeTx distribute transaction
type DeadLockDog ¶
type DeadLockDog interface { // Start run deadlock detection dog, can set how long the delay starts to execute Start(ctx context.Context, delay time.Duration, tx CompositeTx) // HasDeadLock tx deadlock is occur HasDeadLock() bool // Cancel stop run deadlock detection dog Cancel() }
DeadLockDog check target CompositeTx has deadlock
type MockRuntime ¶
type MockRuntime struct {
// contains filtered or unexported fields
}
MockRuntime is a mock of Runtime interface.
func NewMockRuntime ¶
func NewMockRuntime(ctrl *gomock.Controller) *MockRuntime
NewMockRuntime creates a new mock instance.
func (*MockRuntime) EXPECT ¶
func (m *MockRuntime) EXPECT() *MockRuntimeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRuntime) Exec ¶
func (m *MockRuntime) Exec(arg0 context.Context, arg1, arg2 string, arg3 ...proto.Value) (proto.Result, error)
Exec mocks base method.
func (*MockRuntime) Namespace ¶
func (m *MockRuntime) Namespace() *namespace.Namespace
Namespace mocks base method.
type MockRuntimeMockRecorder ¶
type MockRuntimeMockRecorder struct {
// contains filtered or unexported fields
}
MockRuntimeMockRecorder is the mock recorder for MockRuntime.
func (*MockRuntimeMockRecorder) Begin ¶
func (mr *MockRuntimeMockRecorder) Begin(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Begin indicates an expected call of Begin.
func (*MockRuntimeMockRecorder) Exec ¶
func (mr *MockRuntimeMockRecorder) Exec(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call
Exec indicates an expected call of Exec.
func (*MockRuntimeMockRecorder) Execute ¶
func (mr *MockRuntimeMockRecorder) Execute(arg0 interface{}) *gomock.Call
Execute indicates an expected call of Execute.
func (*MockRuntimeMockRecorder) Namespace ¶
func (mr *MockRuntimeMockRecorder) Namespace() *gomock.Call
Namespace indicates an expected call of Namespace.
func (*MockRuntimeMockRecorder) Query ¶
func (mr *MockRuntimeMockRecorder) Query(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call
Query indicates an expected call of Query.
type Runtime ¶
type Runtime interface { proto.Executable proto.VConn // Namespace returns the namespace. Namespace() *namespace.Namespace // Begin begins a new transaction. Begin(ctx context.Context, hooks ...TxHook) (proto.Tx, error) }
Runtime executes a sql statement.
type TxHook ¶
type TxHook interface { // OnTxStateChange Fired when CompositeTx TrxState change OnTxStateChange(ctx context.Context, state TxState, tx CompositeTx) error // OnCreateBranchTx Fired when BranchTx create OnCreateBranchTx(ctx context.Context, tx BranchTx) }
TxHook transaction hook
type TxState ¶
type TxState int32
TxState Transaction status
const ( TrxActive TxState // CompositeTx Default state TrxPreparing // Start executing the first SQL statement TrxPrepared // All SQL statements are executed, and before the Commit statement executes TrxCommitting // After preparing is completed, ready to start execution TrxCommitted // Officially complete the Commit action TrxAborting // There are abnormalities during the execution of the branch, and the composite transaction is prohibited to continue to execute TrxRollback TrxFinish TrxRolledBack )
Directories ¶
Path | Synopsis |
---|---|
Package function provides a set of mysql functions implements by Golang.
|
Package function provides a set of mysql functions implements by Golang. |