Versions in this module Expand all Collapse all v1 v1.2.1 May 30, 2024 Changes in this version + const TwoPhaseActionCommitTagVal + const TwoPhaseActionNameTag + const TwoPhaseActionPrepareTagVal + const TwoPhaseActionRollbackTagVal + const TwoPhaseActionTag + var ErrBranchReportResponseFault = errors.New("branch report response fault") + var TypBusinessContextInterface = reflect.Zero(reflect.TypeOf((*tm.BusinessActionContext)(nil))).Type() + func InitRm(cfg RmConfig) + func IsTwoPhaseAction(v interface{}) bool + type BranchRegisterParam struct + ApplicationData string + BranchType branch.BranchType + ClientId string + LockKeys string + ResourceId string + Xid string + type BranchReportParam struct + ApplicationData string + BranchId int64 + BranchType branch.BranchType + Status branch.BranchStatus + Xid string + type BranchResource struct + ApplicationData []byte + BranchId int64 + BranchType branch.BranchType + ResourceId string + Xid string + type Config struct + AsyncCommitBufferLimit int + LockConfig LockConfig + ReportRetryCount int + ReportSuccessEnable bool + SagaBranchRegisterEnable bool + SagaCompensatePersistModeUpdate bool + SagaJsonParser string + SagaRetryPersistModeUpdate bool + SqlParserType string + TableMetaCheckEnable bool + TccActionInterceptorOrder int + func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) + type LockConfig struct + RetryInterval time.Duration + RetryPolicyBranchRollbackOnConflict bool + RetryTimes int + func (cfg *LockConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) + type LockQueryParam struct + BranchType branch.BranchType + LockKeys string + ResourceId string + Xid string + type RMRemoting struct + func GetRMRemotingInstance() *RMRemoting + func (r *RMRemoting) BranchRegister(param BranchRegisterParam) (int64, error) + func (r *RMRemoting) BranchReport(param BranchReportParam) error + func (r *RMRemoting) LockQuery(param LockQueryParam) (bool, error) + func (r *RMRemoting) RegisterResource(resource Resource) error + type Resource interface + GetBranchType func() branch.BranchType + GetResourceGroupId func() string + GetResourceId func() string + type ResourceManager interface + GetBranchType func() branch.BranchType + GetCachedResources func() *sync.Map + RegisterResource func(resource Resource) error + UnregisterResource func(resource Resource) error + type ResourceManagerCache struct + func GetRmCacheInstance() *ResourceManagerCache + func (d *ResourceManagerCache) GetResourceManager(branchType branch.BranchType) ResourceManager + func (d *ResourceManagerCache) RegisterResourceManager(resourceManager ResourceManager) + type ResourceManagerGetter interface + GetResourceManager func(branchType branch.BranchType) ResourceManager + type ResourceManagerInbound interface + BranchCommit func(ctx context.Context, resource BranchResource) (branch.BranchStatus, error) + BranchRollback func(ctx context.Context, resource BranchResource) (branch.BranchStatus, error) + type ResourceManagerOutbound interface + BranchRegister func(ctx context.Context, param BranchRegisterParam) (int64, error) + BranchReport func(ctx context.Context, param BranchReportParam) error + LockQuery func(ctx context.Context, param LockQueryParam) (bool, error) + type RmConfig struct + ApplicationID string + TxServiceGroup string + type TwoPhaseAction struct + func ParseTwoPhaseAction(v interface{}) (*TwoPhaseAction, error) + func ParseTwoPhaseActionByInterface(v interface{}) (*TwoPhaseAction, error) + func (t *TwoPhaseAction) Commit(ctx context.Context, businessActionContext *tm.BusinessActionContext) (bool, error) + func (t *TwoPhaseAction) GetActionName() string + func (t *TwoPhaseAction) GetCommitMethodName() string + func (t *TwoPhaseAction) GetPrepareMethodName() string + func (t *TwoPhaseAction) GetRollbackMethodName() string + func (t *TwoPhaseAction) GetTwoPhaseService() interface{} + func (t *TwoPhaseAction) Prepare(ctx context.Context, params interface{}) (bool, error) + func (t *TwoPhaseAction) Rollback(ctx context.Context, businessActionContext *tm.BusinessActionContext) (bool, error) + type TwoPhaseInterface interface + Commit func(ctx context.Context, businessActionContext *tm.BusinessActionContext) (bool, error) + GetActionName func() string + Prepare func(ctx context.Context, params interface{}) (bool, error) + Rollback func(ctx context.Context, businessActionContext *tm.BusinessActionContext) (bool, error)