dt

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

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
)
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`
)

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 InitDistributedTransactionManager

func InitDistributedTransactionManager(conf *config.DistributedTransaction)

Types

type BuildUndoSql

type BuildUndoSql func(undoLog undolog.SqlUndoLog) string

type DistributedTransactionManager

type DistributedTransactionManager struct {
	// contains filtered or unexported fields
}

func GetDistributedTransactionManager

func GetDistributedTransactionManager() *DistributedTransactionManager

func (*DistributedTransactionManager) Begin

func (manager *DistributedTransactionManager) Begin(ctx context.Context, transactionName string, timeout int32) (string, error)

func (*DistributedTransactionManager) BranchRegister

func (*DistributedTransactionManager) BranchReport

func (manager *DistributedTransactionManager) BranchReport(ctx context.Context, branchID string, status api.BranchSession_BranchStatus) error

func (*DistributedTransactionManager) Commit

func (*DistributedTransactionManager) IsLockable

func (manager *DistributedTransactionManager) IsLockable(ctx context.Context, resourceID, lockKey string) (bool, error)

func (*DistributedTransactionManager) IsLockableWithXID added in v0.2.2

func (manager *DistributedTransactionManager) IsLockableWithXID(ctx context.Context, resourceID, lockKey, xid string) (bool, error)

func (*DistributedTransactionManager) IsRollingBackDead

func (manager *DistributedTransactionManager) IsRollingBackDead(bs *api.BranchSession) bool

func (*DistributedTransactionManager) ReleaseLockKeys

func (manager *DistributedTransactionManager) ReleaseLockKeys(ctx context.Context, resourceID string, lockKeys []string) (bool, error)

func (*DistributedTransactionManager) Rollback

type MysqlUndoExecutor

type MysqlUndoExecutor struct {
	// contains filtered or unexported fields
}

func NewMysqlUndoExecutor

func NewMysqlUndoExecutor(undoLog *undolog.SqlUndoLog) MysqlUndoExecutor

func (MysqlUndoExecutor) Execute

func (executor MysqlUndoExecutor) Execute(tx proto.Tx) error

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 (manager MysqlUndoLogManager) DeleteUndoLogByLogCreated(db proto.DB, logCreated time.Time, limitRows int) error

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

func (MysqlUndoLogManager) Undo

func (manager MysqlUndoLogManager) Undo(db proto.DB, xid string) ([]string, error)

type RequestContext

type RequestContext struct {
	ActionContext map[string]string
	Headers       map[string]string
	Body          []byte
}

func (*RequestContext) Decode

func (ctx *RequestContext) Decode(b []byte) error

func (*RequestContext) Encode

func (ctx *RequestContext) Encode() ([]byte, error)

type State

type State byte
const (
	Normal State = iota
	GlobalFinished
)

func (State) String

func (state State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL