Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("storage: NotFound")
ErrNotFound defines the query item is not found in storage implement.
View Source
var ErrUniqueConflict = errors.New("storage: UniqueKeyConflict")
ErrUniqueConflict defines the item is conflict with unique key in storage implement.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface {
Ping() error
PopulateData(skipDrop bool)
FindTransGlobalStore(gid string) *TransGlobalStore
ScanTransGlobalStores(position *string, limit int64) []TransGlobalStore
FindBranches(gid string) []TransBranchStore
UpdateBranches(branches []TransBranchStore, updates []string) (int, error)
LockGlobalSaveBranches(gid string, status string, branches []TransBranchStore, branchStart int)
MaySaveNewTrans(global *TransGlobalStore, branches []TransBranchStore) error
ChangeGlobalStatus(global *TransGlobalStore, newStatus string, updates []string, finished bool)
TouchCronTime(global *TransGlobalStore, nextCronInterval int64, nextCronTime *time.Time)
LockOneGlobalTrans(expireIn time.Duration) *TransGlobalStore
ResetCronTime(after time.Duration, limit int64) (succeedCount int64, hasRemaining bool, err error)
}
Store defines storage relevant interface
type TransBranchStore ¶
type TransBranchStore struct {
dtmutil.ModelBase
Gid string `json:"gid,omitempty"`
URL string `json:"url,omitempty"`
BinData []byte `json:"bin_data,omitempty"`
BranchID string `json:"branch_id,omitempty"`
Op string `json:"op,omitempty"`
Status string `json:"status,omitempty"`
FinishTime *time.Time `json:"finish_time,omitempty"`
RollbackTime *time.Time `json:"rollback_time,omitempty"`
Error error `json:"-" gorm:"-"`
}
TransBranchStore branch transaction
func (*TransBranchStore) String ¶
func (b *TransBranchStore) String() string
func (*TransBranchStore) TableName ¶
func (b *TransBranchStore) TableName() string
TableName TableName
type TransGlobalExt ¶ added in v1.8.2
TransGlobalExt defines Header info
type TransGlobalStore ¶
type TransGlobalStore struct {
dtmutil.ModelBase
Gid string `json:"gid,omitempty"`
TransType string `json:"trans_type,omitempty"`
Steps []map[string]string `json:"steps,omitempty" gorm:"-"`
Payloads []string `json:"payloads,omitempty" gorm:"-"`
BinPayloads [][]byte `json:"-" gorm:"-"`
Status string `json:"status,omitempty"`
QueryPrepared string `json:"query_prepared,omitempty"`
Protocol string `json:"protocol,omitempty"`
FinishTime *time.Time `json:"finish_time,omitempty"`
RollbackTime *time.Time `json:"rollback_time,omitempty"`
Result string `json:"result,omitempty"`
RollbackReason string `json:"rollback_reason,omitempty"`
Options string `json:"options,omitempty"`
CustomData string `json:"custom_data,omitempty"`
NextCronInterval int64 `json:"next_cron_interval,omitempty"`
NextCronTime *time.Time `json:"next_cron_time,omitempty"`
Owner string `json:"owner,omitempty"`
Ext TransGlobalExt `json:"-" gorm:"-"`
ExtData string `json:"ext_data,omitempty"` // storage of ext. a db field to store many values. like Options
dtmcli.TransOptions
}
TransGlobalStore defines GlobalStore storage info
func (*TransGlobalStore) IsFinished ¶ added in v1.14.4
func (g *TransGlobalStore) IsFinished() bool
IsFinished return true if status == "failed" || status == "succeed"
func (*TransGlobalStore) String ¶
func (g *TransGlobalStore) String() string
func (*TransGlobalStore) TableName ¶
func (g *TransGlobalStore) TableName() string
TableName TableName
Click to show internal directories.
Click to hide internal directories.