Documentation ¶
Index ¶
- func InitUndoConfig(cfg Config)
- func RegisterUndoLogBuilder(executorType types.ExecutorType, fun func() UndoLogBuilder)
- func RegisterUndoLogManager(m UndoLogManager) error
- type BranchUndoLog
- type CompressConfig
- type Config
- type SQLUndoLog
- type UndoExecutor
- type UndoExecutorHolder
- type UndoLogBuilder
- type UndoLogManager
- type UndoLogStatue
- type UndologRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitUndoConfig ¶
func InitUndoConfig(cfg Config)
func RegisterUndoLogBuilder ¶
func RegisterUndoLogBuilder(executorType types.ExecutorType, fun func() UndoLogBuilder)
func RegisterUndoLogManager ¶
func RegisterUndoLogManager(m UndoLogManager) error
Types ¶
type BranchUndoLog ¶
type BranchUndoLog struct { // Xid Xid string `json:"xid"` // BranchID BranchID uint64 `json:"branchId"` // Logs Logs []SQLUndoLog `json:"sqlUndoLogs"` }
BranchUndoLog
func (*BranchUndoLog) Reverse ¶
func (b *BranchUndoLog) Reverse()
type CompressConfig ¶
type CompressConfig struct { Enable bool `yaml:"enable" json:"enable,omitempty" koanf:"enable"` Type string `yaml:"type" json:"type,omitempty" koanf:"type"` Threshold string `yaml:"threshold" json:"threshold,omitempty" koanf:"threshold"` }
func (*CompressConfig) RegisterFlagsWithPrefix ¶
func (c *CompressConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)
type Config ¶
type Config struct { DataValidation bool `yaml:"data-validation" json:"data-validation,omitempty" koanf:"data-validation"` LogSerialization string `yaml:"log-serialization" json:"log-serialization,omitempty" koanf:"log-serialization"` LogTable string `yaml:"log-table" json:"log-table,omitempty" koanf:"log-table"` OnlyCareUpdateColumns bool `yaml:"only-care-update-columns" json:"only-care-update-columns,omitempty" koanf:"only-care-update-columns"` CompressConfig CompressConfig `yaml:"compress" json:"compress,omitempty" koanf:"compress"` }
var (
UndoConfig Config
)
type SQLUndoLog ¶
type SQLUndoLog struct { SQLType types.SQLType `json:"sqlType"` TableName string `json:"tableName"` BeforeImage *types.RecordImage `json:"beforeImage"` AfterImage *types.RecordImage `json:"afterImage"` }
SQLUndoLog
func (SQLUndoLog) SetTableMeta ¶
func (s SQLUndoLog) SetTableMeta(tableMeta *types.TableMeta)
type UndoExecutor ¶
type UndoExecutorHolder ¶
type UndoExecutorHolder interface { // GetInsertExecutor get the specific Insert UndoExecutor by sqlUndoLog GetInsertExecutor(sqlUndoLog SQLUndoLog) UndoExecutor // GetUpdateExecutor get the specific Update UndoExecutor by sqlUndoLog GetUpdateExecutor(sqlUndoLog SQLUndoLog) UndoExecutor // GetDeleteExecutor get the specific Delete UndoExecutor by sqlUndoLog GetDeleteExecutor(sqlUndoLog SQLUndoLog) UndoExecutor }
type UndoLogBuilder ¶
type UndoLogBuilder interface { BeforeImage(ctx context.Context, execCtx *types.ExecContext) ([]*types.RecordImage, error) AfterImage(ctx context.Context, execCtx *types.ExecContext, beforImages []*types.RecordImage) ([]*types.RecordImage, error) GetExecutorType() types.ExecutorType }
func GetUndologBuilder ¶
func GetUndologBuilder(sqlType types.ExecutorType) UndoLogBuilder
type UndoLogManager ¶
type UndoLogManager interface { Init() // DeleteUndoLog DeleteUndoLog(ctx context.Context, xid string, branchID int64, conn *sql.Conn) error // BatchDeleteUndoLog BatchDeleteUndoLog(xid []string, branchID []int64, conn *sql.Conn) error //FlushUndoLog FlushUndoLog(tranCtx *types.TransactionContext, conn driver.Conn) error // RunUndo RunUndo(ctx context.Context, xid string, branchID int64, conn *sql.DB, dbName string) error // DBType DBType() types.DBType // HasUndoLogTable HasUndoLogTable(ctx context.Context, conn *sql.Conn) (bool, error) }
UndoLogManager
func GetUndoLogManager ¶
func GetUndoLogManager(d types.DBType) (UndoLogManager, error)
GetUndoLogManager
type UndoLogStatue ¶
type UndoLogStatue int8
const ( UndoLogStatueNormnal UndoLogStatue = 0 UndoLogStatueGlobalFinished UndoLogStatue = 1 )
type UndologRecord ¶
type UndologRecord struct { BranchID uint64 `json:"branchId"` XID string `json:"xid"` Context []byte `json:"context"` RollbackInfo []byte `json:"rollbackInfo"` LogStatus UndoLogStatue `json:"logStatus"` LogCreated []byte `json:"logCreated"` LogModified []byte `json:"logModified"` }
func (*UndologRecord) CanUndo ¶
func (u *UndologRecord) CanUndo() bool
Click to show internal directories.
Click to hide internal directories.