Documentation
¶
Index ¶
- Constants
- func CleanTxHooks()
- func RegisterTxHook(h txHook)
- type ATConn
- func (c *ATConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c *ATConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (c *ATConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c *ATConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- type ATSourceManager
- func (a *ATSourceManager) BranchCommit(ctx context.Context, resource rm.BranchResource) (branch.BranchStatus, error)
- func (a *ATSourceManager) BranchRegister(ctx context.Context, req rm.BranchRegisterParam) (int64, error)
- func (a *ATSourceManager) BranchReport(ctx context.Context, param rm.BranchReportParam) error
- func (a *ATSourceManager) BranchRollback(ctx context.Context, branchResource rm.BranchResource) (branch.BranchStatus, error)
- func (a *ATSourceManager) CreateTableMetaCache(ctx context.Context, resID string, dbType types.DBType, db *sql.DB) (datasource.TableMetaCache, error)
- func (a *ATSourceManager) GetBranchType() branch.BranchType
- func (a *ATSourceManager) GetCachedResources() *sync.Map
- func (a *ATSourceManager) LockQuery(ctx context.Context, param rm.LockQueryParam) (bool, error)
- func (a *ATSourceManager) RegisterResource(res rm.Resource) error
- func (a *ATSourceManager) UnregisterResource(res rm.Resource) error
- type ATTx
- type AsyncWorker
- type AsyncWorkerConfig
- type Conn
- func (c *Conn) Begin() (driver.Tx, error)deprecated
- func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c *Conn) Close() error
- func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error)
- func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (c *Conn) Prepare(query string) (driver.Stmt, error)
- func (c *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)
- func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- func (c *Conn) ResetSession(ctx context.Context) error
- type DBResource
- type SqlDBProxy
- type Stmt
- func (s *Stmt) Close() error
- func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)deprecated
- func (s *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *Stmt) NumInput() int
- func (s *Stmt) Query(args []driver.Value) (driver.Rows, error)deprecated
- func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type Tx
- type XAConn
- func (c *XAConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (c *XAConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (c *XAConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c *XAConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- type XATx
Constants ¶
const ( // SeataATMySQLDriver MySQL driver for AT mode SeataATMySQLDriver = "seata-at-mysql" // SeataXAMySQLDriver MySQL driver for XA mode SeataXAMySQLDriver = "seata-xa-mysql" )
const REPORT_RETRY_COUNT = 5
Variables ¶
This section is empty.
Functions ¶
func CleanTxHooks ¶
func CleanTxHooks()
func RegisterTxHook ¶
func RegisterTxHook(h txHook)
Types ¶
type ATConn ¶
type ATConn struct {
*Conn
}
ATConn Database connection proxy object under XA transaction model Conn is assumed to be stateful.
func (*ATConn) ExecContext ¶
func (c *ATConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext
func (*ATConn) PrepareContext ¶
type ATSourceManager ¶
type ATSourceManager struct {
// contains filtered or unexported fields
}
func (*ATSourceManager) BranchCommit ¶
func (a *ATSourceManager) BranchCommit(ctx context.Context, resource rm.BranchResource) (branch.BranchStatus, error)
BranchCommit
func (*ATSourceManager) BranchRegister ¶
func (a *ATSourceManager) BranchRegister(ctx context.Context, req rm.BranchRegisterParam) (int64, error)
BranchRegister
func (*ATSourceManager) BranchReport ¶
func (a *ATSourceManager) BranchReport(ctx context.Context, param rm.BranchReportParam) error
BranchReport
func (*ATSourceManager) BranchRollback ¶
func (a *ATSourceManager) BranchRollback(ctx context.Context, branchResource rm.BranchResource) (branch.BranchStatus, error)
Rollback a branch transaction
func (*ATSourceManager) CreateTableMetaCache ¶
func (a *ATSourceManager) CreateTableMetaCache(ctx context.Context, resID string, dbType types.DBType, db *sql.DB) (datasource.TableMetaCache, error)
CreateTableMetaCache
func (*ATSourceManager) GetBranchType ¶
func (a *ATSourceManager) GetBranchType() branch.BranchType
func (*ATSourceManager) GetCachedResources ¶
func (a *ATSourceManager) GetCachedResources() *sync.Map
Get all resources managed by this manager
func (*ATSourceManager) LockQuery ¶
func (a *ATSourceManager) LockQuery(ctx context.Context, param rm.LockQueryParam) (bool, error)
LockQuery
func (*ATSourceManager) RegisterResource ¶
func (a *ATSourceManager) RegisterResource(res rm.Resource) error
Register a Resource to be managed by Resource Manager
func (*ATSourceManager) UnregisterResource ¶
func (a *ATSourceManager) UnregisterResource(res rm.Resource) error
Unregister a Resource from the Resource Manager
type ATTx ¶
type ATTx struct {
// contains filtered or unexported fields
}
ATTx
type AsyncWorker ¶
type AsyncWorker struct {
// contains filtered or unexported fields
}
AsyncWorker executor for branch transaction commit and undo log
func NewAsyncWorker ¶
func NewAsyncWorker(prom prometheus.Registerer, conf AsyncWorkerConfig, sourceManager datasource.DataSourceManager) *AsyncWorker
func (*AsyncWorker) BranchCommit ¶
func (aw *AsyncWorker) BranchCommit(ctx context.Context, req rm.BranchResource) (branch.BranchStatus, error)
BranchCommit commit branch transaction
type AsyncWorkerConfig ¶
type AsyncWorkerConfig struct {
BufferLimit int `yaml:"buffer_limit" json:"buffer_limit"`
BufferCleanInterval time.Duration `yaml:"buffer_clean_interval" json:"buffer_clean_interval"`
ReceiveChanSize int `yaml:"receive_chan_size" json:"receive_chan_size"`
CommitWorkerCount int `yaml:"commit_worker_count" json:"commit_worker_count"`
CommitWorkerBufferSize int `yaml:"commit_worker_buffer_size" json:"commit_worker_buffer_size"`
}
func (*AsyncWorkerConfig) RegisterFlags ¶
func (cfg *AsyncWorkerConfig) RegisterFlags(f *flag.FlagSet)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) BeginTx ¶
BeginTx Open a transaction and judge whether the current transaction needs to open a
global transaction according to tranCtx. If so, it needs to be included in the transaction management of seata
func (*Conn) Close ¶
Close invalidates and potentially stops any current prepared statements and transactions, marking this connection as no longer in use.
Because the sql package maintains a free pool of connections and only calls Close when there's a surplus of idle connections, it shouldn't be necessary for drivers to do their own connection caching.
Drivers must ensure all network calls made by Close do not block indefinitely (e.g. apply a timeout).
func (*Conn) Exec ¶
Exec warning: if you want to use global transaction, please use ExecContext function
func (*Conn) ExecContext ¶
func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext
func (*Conn) PrepareContext ¶
PrepareContext
type DBResource ¶
type DBResource struct {
// contains filtered or unexported fields
}
DBResource proxy sql.DB, enchance database/sql.DB to add distribute transaction ability
func (*DBResource) GetBranchType ¶
func (db *DBResource) GetBranchType() branch.BranchType
func (*DBResource) GetResourceGroupId ¶
func (db *DBResource) GetResourceGroupId() string
func (*DBResource) GetResourceId ¶
func (db *DBResource) GetResourceId() string
type SqlDBProxy ¶
type SqlDBProxy struct {
// contains filtered or unexported fields
}
func (*SqlDBProxy) GetDB ¶
func (s *SqlDBProxy) GetDB() *sql.DB
func (*SqlDBProxy) GetDBName ¶
func (s *SqlDBProxy) GetDBName() string
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) Close ¶
Close closes the statement.
As of Go 1.1, a Stmt will not be closed if it's in use by any queries.
Drivers must ensure all network calls made by Close do not block indefinitely (e.g. apply a timeout).
func (*Stmt) ExecContext ¶
ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE.
ExecContext must honor the context timeout and return when it is canceled.
func (*Stmt) NumInput ¶
NumInput returns the number of placeholder parameters.
If NumInput returns >= 0, the sql package will sanity check argument counts from callers and return errors to the caller before the statement's Exec or Query methods are called.
NumInput may also return -1, if the driver doesn't know its number of placeholders. In that case, the sql package will not sanity check Exec or Query argument counts.
func (*Stmt) QueryContext ¶
StmtQueryContext enhances the Stmt interface by providing Query with context. QueryContext executes a query that may return rows, such as a SELECT.
QueryContext must honor the context timeout and return when it is canceled.
type XAConn ¶
type XAConn struct {
*Conn
}
XAConn Database connection proxy object under XA transaction model Conn is assumed to be stateful.
func (*XAConn) ExecContext ¶
func (c *XAConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext
func (*XAConn) PrepareContext ¶
PrepareContext