meta

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchStatus

type BranchStatus byte

BranchStatus

const (
	// The BranchStatus_Unknown.
	// description:BranchStatus_Unknown branch status.
	BranchStatusUnknown BranchStatus = iota

	// The BranchStatus_Registered.
	// description:BranchStatus_Registered to TC.
	BranchStatusRegistered

	// The Phase one done.
	// description:Branch logic is successfully done at phase one.
	BranchStatusPhaseOneDone

	// The Phase one failed.
	// description:Branch logic is failed at phase one.
	BranchStatusPhaseOneFailed

	// The Phase one timeout.
	// description:Branch logic is NOT reported for a timeout.
	BranchStatusPhaseOneTimeout

	// The Phase two committed.
	// description:Commit logic is successfully done at phase two.
	BranchStatusPhaseTwoCommitted

	// The Phase two commit failed retryable.
	// description:Commit logic is failed but retryable.
	BranchStatusPhaseTwoCommitFailedRetryable

	// The Phase two commit failed can not retry.
	// description:Commit logic is failed and NOT retryable.
	BranchStatusPhaseTwoCommitFailedCanNotRetry

	// The Phase two rolled back.
	// description:Rollback logic is successfully done at phase two.
	BranchStatusPhaseTwoRolledBack

	// The Phase two rollback failed retryable.
	// description:Rollback logic is failed but retryable.
	BranchStatusPhaseTwoRollbackFailedRetryable

	// The Phase two rollback failed can not retry.
	// description:Rollback logic is failed but NOT retryable.
	BranchStatusPhaseTwoRollbackFailedCanNotRetry
)

func (BranchStatus) String

func (s BranchStatus) String() string

type BranchType

type BranchType byte

BranchTrype

const (
	// The At.
	// BranchType_AT Branch
	BranchTypeAT BranchType = iota

	//The BranchType_TCC.
	BranchTypeTCC

	// The BranchType_SAGA.
	BranchTypeSAGA
)

func ValueOfBranchType

func ValueOfBranchType(branchType string) BranchType

ValueOfBranchType value of branch type

func (BranchType) String

func (t BranchType) String() string

String string of branch type

type GlobalStatus

type GlobalStatus int32
const (
	// Un known global status.
	// BranchStatus_Unknown
	GlobalStatusUnknown GlobalStatus = iota

	// The GlobalStatus_Begin.
	// PHASE 1: can accept new branch registering.
	GlobalStatusBegin

	// PHASE 2: Running Status: may be changed any time.
	// Committing.
	GlobalStatusCommitting

	// The Commit retrying.
	// Retrying commit after a recoverable failure.
	GlobalStatusCommitRetrying

	// Rolling back global status.
	GlobalStatusRollingBack

	// The Rollback retrying.
	// Retrying rollback after a recoverable failure.
	GlobalStatusRollbackRetrying

	// The Timeout rollingBack.
	// RollingBack since timeout
	GlobalStatusTimeoutRollingBack

	// The Timeout rollback retrying.
	// Retrying rollback (since timeout) after a recoverable failure.
	GlobalStatusTimeoutRollbackRetrying

	// All branches can be async committed. The committing is NOT done yet, but it can be seen as committed for TM/RM
	// rpc_client.
	GlobalStatusAsyncCommitting

	// PHASE 2: Final Status: will NOT change any more.
	// Finally: global transaction is successfully committed.
	GlobalStatusCommitted

	// The Commit failed.
	// Finally: failed to commit
	GlobalStatusCommitFailed

	// The Rolled back.
	// Finally: global transaction is successfully rolled back.
	GlobalStatusRolledBack

	// The Rollback failed.
	// Finally: failed to rollback
	GlobalStatusRollbackFailed

	// The Timeout rolled back.
	// Finally: global transaction is successfully rolled back since timeout.
	GlobalStatusTimeoutRolledBack

	// The Timeout rollback failed.
	// Finally: failed to rollback since timeout
	GlobalStatusTimeoutRollbackFailed

	// The Finished.
	// Not managed in getty_session MAP any more
	GlobalStatusFinished
)

func (GlobalStatus) String

func (s GlobalStatus) String() string

String string of global status

type TransactionException

type TransactionException struct {
	Code    TransactionExceptionCode
	Message string
	Err     error
}

TransactionException

func NewTransactionException

func NewTransactionException(err error, opts ...TransactionExceptionOption) *TransactionException

NewTransactionException

func (*TransactionException) Error

func (e *TransactionException) Error() string

Error

func (*TransactionException) Unwrap

func (e *TransactionException) Unwrap() error

Unwrap

type TransactionExceptionCode

type TransactionExceptionCode byte
const (
	// Unknown transaction exception code.
	TransactionExceptionCodeUnknown TransactionExceptionCode = iota

	// BeginFailed
	TransactionExceptionCodeBeginFailed

	// Lock key conflict transaction exception code.
	TransactionExceptionCodeLockKeyConflict

	// Io transaction exception code.
	IO

	// Branch rollback failed retriable transaction exception code.
	TransactionExceptionCodeBranchRollbackFailedRetriable

	// Branch rollback failed unretriable transaction exception code.
	TransactionExceptionCodeBranchRollbackFailedUnretriable

	// Branch register failed transaction exception code.
	TransactionExceptionCodeBranchRegisterFailed

	// Branch report failed transaction exception code.
	TransactionExceptionCodeBranchReportFailed

	// Lockable check failed transaction exception code.
	TransactionExceptionCodeLockableCheckFailed

	// Branch transaction not exist transaction exception code.
	TransactionExceptionCodeBranchTransactionNotExist

	// Global transaction not exist transaction exception code.
	TransactionExceptionCodeGlobalTransactionNotExist

	// Global transaction not active transaction exception code.
	TransactionExceptionCodeGlobalTransactionNotActive

	// Global transaction status invalid transaction exception code.
	TransactionExceptionCodeGlobalTransactionStatusInvalid

	// Failed to send branch commit request transaction exception code.
	TransactionExceptionCodeFailedToSendBranchCommitRequest

	// Failed to send branch rollback request transaction exception code.
	TransactionExceptionCodeFailedToSendBranchRollbackRequest

	// Failed to add branch transaction exception code.
	TransactionExceptionCodeFailedToAddBranch

	// Failed to lock global transaction exception code.
	TransactionExceptionCodeFailedLockGlobalTranscation

	// FailedWriteSession
	TransactionExceptionCodeFailedWriteSession

	// Failed to holder exception code
	FailedStore
)

type TransactionExceptionOption

type TransactionExceptionOption func(exception *TransactionException)

TransactionExceptionOption used to construct TransactionException

func WithMessage

func WithMessage(message string) TransactionExceptionOption

WithMessage

func WithTransactionExceptionCode

func WithTransactionExceptionCode(code TransactionExceptionCode) TransactionExceptionOption

WithTransactionExceptionCode

type TransactionRole

type TransactionRole byte

TransactionRole

const (
	// tm
	TMRole TransactionRole = iota
	// rm
	RMRole
	// server
	ServerRole
)

func (TransactionRole) String

func (r TransactionRole) String() string

String string of transaction role

Jump to

Keyboard shortcuts

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