session

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchSession

type BranchSession struct {
	XID string

	TransactionID int64

	BranchID int64

	ResourceGroupID string

	ResourceID string

	LockKey string

	BranchType meta.BranchType

	Status meta.BranchStatus

	ClientID string

	ApplicationData []byte
}

func NewBranchSession

func NewBranchSession(opts ...BranchSessionOption) *BranchSession

func NewBranchSessionByGlobal

func NewBranchSessionByGlobal(gs GlobalSession, opts ...BranchSessionOption) *BranchSession

func (*BranchSession) CompareTo

func (bs *BranchSession) CompareTo(session *BranchSession) int

func (*BranchSession) Decode

func (bs *BranchSession) Decode(b []byte)

func (*BranchSession) Encode

func (bs *BranchSession) Encode() ([]byte, error)

type BranchSessionOption

type BranchSessionOption func(session *BranchSession)

func WithBsApplicationData

func WithBsApplicationData(applicationData []byte) BranchSessionOption

func WithBsBranchID

func WithBsBranchID(branchID int64) BranchSessionOption

func WithBsBranchType

func WithBsBranchType(branchType meta.BranchType) BranchSessionOption

func WithBsClientID

func WithBsClientID(clientID string) BranchSessionOption

func WithBsLockKey

func WithBsLockKey(lockKey string) BranchSessionOption

func WithBsResourceGroupID

func WithBsResourceGroupID(resourceGroupID string) BranchSessionOption

func WithBsResourceID

func WithBsResourceID(resourceID string) BranchSessionOption

func WithBsStatus

func WithBsStatus(status meta.BranchStatus) BranchSessionOption

func WithBsTransactionID

func WithBsTransactionID(transactionID int64) BranchSessionOption

func WithBsXid

func WithBsXid(xid string) BranchSessionOption

type BranchSessionSlice

type BranchSessionSlice []*BranchSession

func (BranchSessionSlice) Len

func (p BranchSessionSlice) Len() int

func (BranchSessionSlice) Less

func (p BranchSessionSlice) Less(i, j int) bool

func (BranchSessionSlice) Swap

func (p BranchSessionSlice) Swap(i, j int)

type GlobalSession

type GlobalSession struct {
	sync.Mutex

	XID string

	TransactionID int64

	Status meta.GlobalStatus

	ApplicationID string

	TransactionServiceGroup string

	TransactionName string

	Timeout int32

	BeginTime int64

	ApplicationData []byte

	Active bool

	BranchSessions map[*BranchSession]bool
}

func NewGlobalSession

func NewGlobalSession(opts ...GlobalSessionOption) *GlobalSession

func (*GlobalSession) Add

func (gs *GlobalSession) Add(branchSession *BranchSession)

func (*GlobalSession) Begin

func (gs *GlobalSession) Begin()

func (*GlobalSession) CanBeCommittedAsync

func (gs *GlobalSession) CanBeCommittedAsync() bool

func (*GlobalSession) Decode

func (gs *GlobalSession) Decode(b []byte)

func (*GlobalSession) Encode

func (gs *GlobalSession) Encode() ([]byte, error)

func (*GlobalSession) GetBranch

func (gs *GlobalSession) GetBranch(branchID int64) *BranchSession

func (*GlobalSession) GetReverseSortedBranches

func (gs *GlobalSession) GetReverseSortedBranches() []*BranchSession

func (*GlobalSession) GetSortedBranches

func (gs *GlobalSession) GetSortedBranches() []*BranchSession

func (*GlobalSession) HasBranch

func (gs *GlobalSession) HasBranch() bool

func (*GlobalSession) IsRollbackingDead

func (gs *GlobalSession) IsRollbackingDead() bool

func (*GlobalSession) IsSaga

func (gs *GlobalSession) IsSaga() bool

func (*GlobalSession) IsTimeout

func (gs *GlobalSession) IsTimeout() bool

func (*GlobalSession) Remove

func (gs *GlobalSession) Remove(branchSession *BranchSession)

type GlobalSessionOption

type GlobalSessionOption func(session *GlobalSession)

func WithGsActive

func WithGsActive(active bool) GlobalSessionOption

func WithGsApplicationData

func WithGsApplicationData(applicationData []byte) GlobalSessionOption

func WithGsApplicationID

func WithGsApplicationID(applicationID string) GlobalSessionOption

func WithGsBeginTime

func WithGsBeginTime(beginTime int64) GlobalSessionOption

func WithGsStatus

func WithGsStatus(status meta.GlobalStatus) GlobalSessionOption

func WithGsTimeout

func WithGsTimeout(timeout int32) GlobalSessionOption

func WithGsTransactionID

func WithGsTransactionID(transactionID int64) GlobalSessionOption

func WithGsTransactionName

func WithGsTransactionName(transactionName string) GlobalSessionOption

func WithGsTransactionServiceGroup

func WithGsTransactionServiceGroup(transactionServiceGroup string) GlobalSessionOption

func WithGsXID

func WithGsXID(xid string) GlobalSessionOption

type SessionStorable

type SessionStorable interface {
	/**
	 * Encode byte [ ].
	 *
	 * @return the byte [ ]
	 */
	Encode() ([]byte, error)

	/**
	 * Decode.
	 *
	 * @param src the src
	 */
	Decode(src []byte)
}

Jump to

Keyboard shortcuts

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