session

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 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