Documentation ¶
Index ¶
- Constants
- Variables
- func BuildDeleteUndoSql(undoLog *undolog.SqlUndoLog) string
- func BuildInsertUndoSql(undoLog *undolog.SqlUndoLog) string
- func BuildUpdateUndoSql(undoLog *undolog.SqlUndoLog) string
- func GetTransactionManager(appID string) proto.DistributedTransactionManager
- func RegisterTransactionManager(conf *config.DistributedTransaction)
- type BuildUndoSql
- type DistributedTransactionManager
- func (manager *DistributedTransactionManager) Begin(ctx context.Context, transactionName string, timeout int32) (string, error)
- func (manager *DistributedTransactionManager) BranchRegister(ctx context.Context, in *api.BranchRegisterRequest) (string, int64, error)
- func (manager *DistributedTransactionManager) BranchReport(ctx context.Context, branchID string, status api.BranchSession_BranchStatus) error
- func (manager *DistributedTransactionManager) Commit(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
- func (manager *DistributedTransactionManager) IsLockable(ctx context.Context, resourceID, lockKey string) (bool, error)
- func (manager *DistributedTransactionManager) IsLockableWithXID(ctx context.Context, resourceID, lockKey, xid string) (bool, error)
- func (manager *DistributedTransactionManager) IsMaster() bool
- func (manager *DistributedTransactionManager) IsRollingBackDead(bs *api.BranchSession) bool
- func (manager *DistributedTransactionManager) ListDeadBranchSessions(ctx context.Context) ([]*api.BranchSession, error)
- func (manager *DistributedTransactionManager) ReleaseLockKeys(ctx context.Context, resourceID string, lockKeys []string) (bool, error)
- func (manager *DistributedTransactionManager) Rollback(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
- type MysqlUndoExecutor
- type MysqlUndoLogManager
- func (manager MysqlUndoLogManager) DeleteUndoLogByID(db proto.DB, id int64) error
- func (manager MysqlUndoLogManager) DeleteUndoLogByLogCreated(db proto.DB, logCreated time.Time, limitRows int) error
- func (manager MysqlUndoLogManager) DeleteUndoLogByXID(db proto.DB, xid string) error
- func (manager MysqlUndoLogManager) InsertUndoLogWithGlobalFinished(conn proto.Connection, xid string, branchID int64, undoLog *undolog.SqlUndoLog) error
- func (manager MysqlUndoLogManager) InsertUndoLogWithNormal(conn proto.Connection, xid string, branchID int64, undoLog *undolog.SqlUndoLog) error
- func (manager MysqlUndoLogManager) Undo(db proto.DB, xid string) ([]string, error)
- type RequestContext
- type State
Constants ¶
View Source
const ( InsertSqlTemplate = "INSERT INTO %s (%s) VALUES (%s)" DeleteSqlTemplate = "DELETE FROM %s WHERE `%s` = ?" UpdateSqlTemplate = "UPDATE %s SET %s WHERE `%s` = ?" SelectSqlTemplate = "SELECT %s FROM %s WHERE `%s` IN %s" )
View Source
const ( DeleteUndoLogByIDSql = "DELETE FROM undo_log WHERE id = ?" DeleteUndoLogByXIDSql = "DELETE FROM undo_log WHERE xid = ?" DeleteUndoLogByCreateSql = "DELETE FROM undo_log WHERE log_created <= ? LIMIT ?" InsertUndoLogSql = `` /* 139-byte string literal not displayed */ SelectUndoLogSql = `SELECT branch_id, context, rollback_info, log_status FROM undo_log WHERE xid = ? ORDER BY id DESC FOR UPDATE` )
View Source
const ( // CommitRequestPath represents for tcc commit request path CommitRequestPath = "tcc_commit_request_path" // RollbackRequestPath represents for tcc rollback request path RollbackRequestPath = "tcc_rollback_request_path" // DefaultRetryDeadThreshold is max retry milliseconds DefaultRetryDeadThreshold = 130 * 1000 )
Variables ¶
View Source
var ( VarHost = "host" VarQueryString = "queryString" )
Functions ¶
func BuildDeleteUndoSql ¶ added in v0.1.1
func BuildDeleteUndoSql(undoLog *undolog.SqlUndoLog) string
func BuildInsertUndoSql ¶ added in v0.1.1
func BuildInsertUndoSql(undoLog *undolog.SqlUndoLog) string
func BuildUpdateUndoSql ¶ added in v0.1.1
func BuildUpdateUndoSql(undoLog *undolog.SqlUndoLog) string
func GetTransactionManager ¶ added in v0.4.0
func GetTransactionManager(appID string) proto.DistributedTransactionManager
func RegisterTransactionManager ¶ added in v0.4.0
func RegisterTransactionManager(conf *config.DistributedTransaction)
Types ¶
type BuildUndoSql ¶
type BuildUndoSql func(undoLog undolog.SqlUndoLog) string
type DistributedTransactionManager ¶
type DistributedTransactionManager struct {
// contains filtered or unexported fields
}
func (*DistributedTransactionManager) BranchRegister ¶
func (manager *DistributedTransactionManager) BranchRegister(ctx context.Context, in *api.BranchRegisterRequest) (string, int64, error)
func (*DistributedTransactionManager) BranchReport ¶
func (manager *DistributedTransactionManager) BranchReport(ctx context.Context, branchID string, status api.BranchSession_BranchStatus) error
func (*DistributedTransactionManager) Commit ¶
func (manager *DistributedTransactionManager) Commit(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
func (*DistributedTransactionManager) IsLockable ¶
func (*DistributedTransactionManager) IsLockableWithXID ¶ added in v0.2.2
func (*DistributedTransactionManager) IsMaster ¶ added in v0.5.0
func (manager *DistributedTransactionManager) IsMaster() bool
func (*DistributedTransactionManager) IsRollingBackDead ¶
func (manager *DistributedTransactionManager) IsRollingBackDead(bs *api.BranchSession) bool
func (*DistributedTransactionManager) ListDeadBranchSessions ¶ added in v0.5.0
func (manager *DistributedTransactionManager) ListDeadBranchSessions(ctx context.Context) ([]*api.BranchSession, error)
func (*DistributedTransactionManager) ReleaseLockKeys ¶
func (*DistributedTransactionManager) Rollback ¶
func (manager *DistributedTransactionManager) Rollback(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
type MysqlUndoExecutor ¶
type MysqlUndoExecutor struct {
// contains filtered or unexported fields
}
func NewMysqlUndoExecutor ¶
func NewMysqlUndoExecutor(undoLog *undolog.SqlUndoLog) MysqlUndoExecutor
type MysqlUndoLogManager ¶
type MysqlUndoLogManager struct { }
func GetUndoLogManager ¶
func GetUndoLogManager() MysqlUndoLogManager
func (MysqlUndoLogManager) DeleteUndoLogByID ¶
func (manager MysqlUndoLogManager) DeleteUndoLogByID(db proto.DB, id int64) error
func (MysqlUndoLogManager) DeleteUndoLogByLogCreated ¶
func (MysqlUndoLogManager) DeleteUndoLogByXID ¶
func (manager MysqlUndoLogManager) DeleteUndoLogByXID(db proto.DB, xid string) error
func (MysqlUndoLogManager) InsertUndoLogWithGlobalFinished ¶
func (manager MysqlUndoLogManager) InsertUndoLogWithGlobalFinished(conn proto.Connection, xid string, branchID int64, undoLog *undolog.SqlUndoLog) error
func (MysqlUndoLogManager) InsertUndoLogWithNormal ¶
func (manager MysqlUndoLogManager) InsertUndoLogWithNormal(conn proto.Connection, xid string, branchID int64, undoLog *undolog.SqlUndoLog) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.