meta

package
v0.0.0-...-a7a8f6c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// FlagRequest flag request
	FlagRequest uint16 = 0x80
	// FlagAsync flag async
	FlagAsync uint16 = 0x40
	// FlagHeartbeat flag hb
	FlagHeartbeat uint16 = 0x20
	// FlagSeataCodec seata codec
	FlagSeataCodec uint16 = 0x10
)
View Source
const (
	// NoneAction none action
	NoneAction = Action(0)
	// RollbackAction rollback action
	RollbackAction = Action(1)
	// CommitAction commit action
	CommitAction = Action(2)
)
View Source
const (
	// Failed failed
	Failed byte = 0
	// Succeed Succeed
	Succeed byte = 1
)
View Source
const (
	// TypeHeartbeat msg type
	TypeHeartbeat uint16 = 0
	// TypeGlobalBegin msg type
	TypeGlobalBegin uint16 = 1
	// TypeGlobalBeginResult msg type
	TypeGlobalBeginResult uint16 = 2
	// TypeBranchCommit msg type
	TypeBranchCommit uint16 = 3
	// TypeBranchCommitResult msg type
	TypeBranchCommitResult uint16 = 4
	// TypeBranchRollback msg type
	TypeBranchRollback uint16 = 5
	// TypeBranchRollbackResult msg type
	TypeBranchRollbackResult uint16 = 6
	// TypeGlobalCommit msg type
	TypeGlobalCommit uint16 = 7
	// TypeGlobalCommitResult msg type
	TypeGlobalCommitResult uint16 = 8
	// TypeGlobalRollback msg type
	TypeGlobalRollback uint16 = 9
	// TypeGlobalRollbackResult msg type
	TypeGlobalRollbackResult uint16 = 10
	// TypeBranchRegister msg type
	TypeBranchRegister uint16 = 11
	// TypeBranchRegisterResult msg type
	TypeBranchRegisterResult uint16 = 12
	// TypeBranchStatusReport msg type
	TypeBranchStatusReport uint16 = 13
	// TypeBranchStatusReportResult msg type
	TypeBranchStatusReportResult uint16 = 14
	// TypeGlobalStatus msg type
	TypeGlobalStatus uint16 = 15
	// TypeGlobalStatusResult msg type
	TypeGlobalStatusResult uint16 = 16
	// TypeGlobalLockQuery msg type
	TypeGlobalLockQuery uint16 = 21
	// TypeGlobalLockQueryResult msg type
	TypeGlobalLockQueryResult uint16 = 22
	// TypeSeataMerge msg type
	TypeSeataMerge uint16 = 59
	// TypeSeataMergeResult msg type
	TypeSeataMergeResult uint16 = 60
	// TypeRegClt msg type
	TypeRegClt uint16 = 101
	// TypeRegCltResult msg type
	TypeRegCltResult uint16 = 102
	// TypeRegRM msg type
	TypeRegRM uint16 = 103
	// TypeRegRMResult msg type
	TypeRegRMResult uint16 = 104
	// TypeRetryNotLeader for sharding
	TypeRetryNotLeader uint16 = math.MaxUint16
)

Variables

View Source
var (

	// SeataDecoder seata decoder
	SeataDecoder = fc
	// SeataEncoder seata encoder
	SeataEncoder = fc
	// SeataHB heartbeat msg
	SeataHB = &HeartbeatMessage{}
)
View Source
var (

	// ProxyDecoder proxy routeable message decoder
	ProxyDecoder = goetty.NewIntLengthFieldBasedDecoder(pc)
	// ProxyEncoder proxy routeable message encoder
	ProxyEncoder = goetty.NewIntLengthFieldBasedEncoder(pc)
)
View Source
var (
	// ShardingEncoder sharding encode
	ShardingEncoder = goetty.NewIntLengthFieldBasedEncoder(&shardingCodec{})
	// ShardingDecoder sharding decoder
	ShardingDecoder = goetty.NewIntLengthFieldBasedDecoder(&shardingCodec{})
)
View Source
var (
	// ErrUnknown Unknown err
	ErrUnknown = newError(0)
	// ErrLockKeyConflict LockKeyConflict err
	ErrLockKeyConflict = newError(1)
	// ErrIO io err
	ErrIO = newError(2)
	// ErrBranchRollbackFailedRetryable BranchRollbackFailedRetryable err
	ErrBranchRollbackFailedRetryable = newError(3)
	// ErrBranchRollbackFailedUnretryable BranchRollbackFailedUnRetryable err
	ErrBranchRollbackFailedUnretryable = newError(4)
	// ErrBranchRegisterFailed BranchRegisterFailed err
	ErrBranchRegisterFailed = newError(5)
	// ErrBranchReportFailed BranchReportFailed err
	ErrBranchReportFailed = newError(6)
	// ErrLockableCheckFailed LockableCheckFailed Err
	ErrLockableCheckFailed = newError(7)
	// ErrBranchTransactionNotExist BranchTransactionNotExist err
	ErrBranchTransactionNotExist = newError(8)
	// ErrGlobalTransactionNotExist GlobalTransactionNotExist err
	ErrGlobalTransactionNotExist = newError(9)
	// ErrGlobalTransactionNotActive GlobalTransactionNotActive err
	ErrGlobalTransactionNotActive = newError(10)
	// ErrGlobalTransactionStatusInvalid GlobalTransactionStatusInvalid err
	ErrGlobalTransactionStatusInvalid = newError(11)
	// ErrFailedToSendBranchCommitRequest FailedToSendBranchCommitRequest err
	ErrFailedToSendBranchCommitRequest = newError(12)
	// ErrFailedToSendBranchRollbackRequest FailedToSendBranchRollbackRequest err
	ErrFailedToSendBranchRollbackRequest = newError(13)
	// ErrFailedToAddBranch FailedToAddBranch err
	ErrFailedToAddBranch = newError(14)

	// ErrNotLeader errors is not leader
	ErrNotLeader = errors.New("is not leader")
)
View Source
var (
	// AT auto transaction
	AT = BranchType(0)
	// TCC manual transaction
	TCC = BranchType(1)
)
View Source
var (
	// BranchStatusUnknown Unknown
	BranchStatusUnknown = BranchStatus(0)
	// BranchStatusRegistered Registered to TC
	BranchStatusRegistered = BranchStatus(1)
	// BranchStatusPhaseOneDone Branch logic is successfully done at phase one
	BranchStatusPhaseOneDone = BranchStatus(2)
	// BranchStatusPhaseOneFailed Branch logic is failed at phase one
	BranchStatusPhaseOneFailed = BranchStatus(3)
	// BranchStatusPhaseOneTimeout Branch logic is NOT reported for a timeout
	BranchStatusPhaseOneTimeout = BranchStatus(4)
	// BranchStatusPhaseTwoCommitted Commit logic is succeed done at phase two
	BranchStatusPhaseTwoCommitted = BranchStatus(5)
	// BranchStatusPhaseTwoCommitFailedRetriable Commit logic is failed but retriable.
	BranchStatusPhaseTwoCommitFailedRetriable = BranchStatus(6)
	// BranchStatusPhaseTwoCommitFailedUnretriable Commit logic is failed and NOT retryable.
	BranchStatusPhaseTwoCommitFailedUnretriable = BranchStatus(7)
	// BranchStatusPhaseTwoRollbacked logic is rollback succeed done at phase two.
	BranchStatusPhaseTwoRollbacked = BranchStatus(8)
	// BranchStatusPhaseTwoRollbackFailedRetriable Rollback logic is failed but retriable.
	BranchStatusPhaseTwoRollbackFailedRetriable = BranchStatus(9)
	// BranchStatusPhaseTwoRollbackFailedUnretriable Rollback logic is failed but NOT retriable.
	BranchStatusPhaseTwoRollbackFailedUnretriable = BranchStatus(10)
)
View Source
var (
	// GlobalStatusUnKnown Unknown
	GlobalStatusUnKnown = GlobalStatus(0)
	// GlobalStatusBegin PHASE 1: can accept new branch registering.
	GlobalStatusBegin = GlobalStatus(1)

	// GlobalStatusCommitting Committing.
	GlobalStatusCommitting = GlobalStatus(2)
	// GlobalStatusRetryCommitting Retrying commit after a recoverable failure.
	GlobalStatusRetryCommitting = GlobalStatus(3)
	// GlobalStatusRollbacking Rollbacking
	GlobalStatusRollbacking = GlobalStatus(4)
	// GlobalStatusRetryRollbacking Retrying rollback after a recoverable failure.
	GlobalStatusRetryRollbacking = GlobalStatus(5)
	// GlobalStatusRollbackingSinceTimeout Rollbacking since timeout
	GlobalStatusRollbackingSinceTimeout = GlobalStatus(6)
	// GlobalStatusRetryRollbackingSinceTimeout Retrying rollback (since timeout) after a recoverable failure.
	GlobalStatusRetryRollbackingSinceTimeout = GlobalStatus(7)

	// GlobalStatusCommitted Finally: global transaction is successfully committed.
	GlobalStatusCommitted = GlobalStatus(8)
	// GlobalStatusCommitFailed Finally: failed to commit
	GlobalStatusCommitFailed = GlobalStatus(9)
	// GlobalStatusRollbacked Finally: global transaction is successfully rollbacked.
	GlobalStatusRollbacked = GlobalStatus(10)
	// GlobalStatusRollbackFailed Finally: failed to rollback
	GlobalStatusRollbackFailed = GlobalStatus(11)
	// GlobalStatusRollbackedSinceTimeout Finally: global transaction is successfully rollbacked since timeout.
	GlobalStatusRollbackedSinceTimeout = GlobalStatus(12)
	// GlobalStatusRollbackFailedSinceTimeout Finally: failed to rollback since timeout
	GlobalStatusRollbackFailedSinceTimeout = GlobalStatus(13)
	// GlobalStatusFinished Not managed in session map any more
	GlobalStatusFinished = GlobalStatus(14)
)
View Source
var (
	// EmptyQuery empty query
	EmptyQuery = Query{Status: -1, Action: -1}
)

Functions

func MaybeReadBigString

func MaybeReadBigString(buf *goetty.ByteBuf) (string, bool)

MaybeReadBigString maybe read string value

func MaybeReadString

func MaybeReadString(buf *goetty.ByteBuf) (string, bool)

MaybeReadString maybe read string value

func ReadBigString

func ReadBigString(buf *goetty.ByteBuf) string

ReadBigString read big string

func ReadBool

func ReadBool(in *goetty.ByteBuf) bool

ReadBool read bool

func ReadByte

func ReadByte(buf *goetty.ByteBuf) byte

ReadByte read byte value

func ReadBytes

func ReadBytes(n int, buf *goetty.ByteBuf) []byte

ReadBytes read bytes value

func ReadInt

func ReadInt(buf *goetty.ByteBuf) int

ReadInt read int value

func ReadPeer

func ReadPeer(in *goetty.ByteBuf) prophet.Peer

ReadPeer read peer

func ReadPeers

func ReadPeers(in *goetty.ByteBuf) []prophet.Peer

ReadPeers read peers

func ReadSlice

func ReadSlice(buf *goetty.ByteBuf) []byte

ReadSlice read slice value

func ReadString

func ReadString(buf *goetty.ByteBuf) string

ReadString read string value

func ReadUInt16

func ReadUInt16(buf *goetty.ByteBuf) uint16

ReadUInt16 read uint16 value

func ReadUInt64

func ReadUInt64(buf *goetty.ByteBuf) uint64

ReadUInt64 read uint64 value

func TagBranchTransaction

func TagBranchTransaction(gid, bid uint64, action string) string

TagBranchTransaction reutrns a branch transaction

func TagGlobalTransaction

func TagGlobalTransaction(gid uint64, action string) string

TagGlobalTransaction reutrns a global transaction

func WriteBigString

func WriteBigString(value string, buf *goetty.ByteBuf)

WriteBigString write big string

func WriteBool

func WriteBool(value bool, out *goetty.ByteBuf)

WriteBool write bool value

func WritePeer

func WritePeer(peer prophet.Peer, out *goetty.ByteBuf)

WritePeer write peer

func WritePeers

func WritePeers(peers []prophet.Peer, out *goetty.ByteBuf)

WritePeers write peers

func WriteSlice

func WriteSlice(value []byte, buf *goetty.ByteBuf)

WriteSlice write slice value

func WriteString

func WriteString(value string, buf *goetty.ByteBuf)

WriteString write string value

func WriteXID

func WriteXID(value FragmentXID, buf *goetty.ByteBuf)

WriteXID write xid value

Types

type Action

type Action int

Action transaction status

func (*Action) Name

func (s *Action) Name() string

Name enum name

type BranchCommitRequest

type BranchCommitRequest struct {
	// contains filtered or unexported fields
}

BranchCommitRequest commit branch request

func AcquireBranchCommitRequest

func AcquireBranchCommitRequest() *BranchCommitRequest

AcquireBranchCommitRequest acquire a value from pool

func (*BranchCommitRequest) BatchEncode

func (msg *BranchCommitRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*BranchCommitRequest) Decode

func (msg *BranchCommitRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchCommitRequest) Encode

func (msg *BranchCommitRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchCommitRequest) MaybeDecode

func (msg *BranchCommitRequest) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode maybe decode message from byte buffer

func (*BranchCommitRequest) Type

func (msg *BranchCommitRequest) Type() uint16

Type returns message type

type BranchCommitResponse

type BranchCommitResponse struct {
	// contains filtered or unexported fields
}

BranchCommitResponse commit a branch transaction response

func AcquireBranchCommitResponse

func AcquireBranchCommitResponse() *BranchCommitResponse

AcquireBranchCommitResponse acquire a value from pool

func (*BranchCommitResponse) BatchEncode

func (msg *BranchCommitResponse) BatchEncode(buf *goetty.ByteBuf)

func (*BranchCommitResponse) Decode

func (msg *BranchCommitResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchCommitResponse) Encode

func (msg *BranchCommitResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchCommitResponse) MaybeDecode

func (msg *BranchCommitResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode maybe decode message from byte buffer

func (*BranchCommitResponse) Type

func (msg *BranchCommitResponse) Type() uint16

Type returns message type

type BranchRegisterRequest

type BranchRegisterRequest struct {
	XID             FragmentXID
	BranchType      BranchType
	ResourceID      string
	LockKey         string // table1:pk1,pk2;table2:pk1,pk2
	ApplicationData string
}

BranchRegisterRequest register a branch request

func AcquireBranchRegisterRequest

func AcquireBranchRegisterRequest() *BranchRegisterRequest

AcquireBranchRegisterRequest acquire a value from pool

func (*BranchRegisterRequest) BatchEncode

func (msg *BranchRegisterRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*BranchRegisterRequest) Decode

func (msg *BranchRegisterRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchRegisterRequest) Encode

func (msg *BranchRegisterRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchRegisterRequest) ToCreateBranchTransaction

func (msg *BranchRegisterRequest) ToCreateBranchTransaction(rmSID string) (CreateBranchTransaction, error)

ToCreateBranchTransaction adapter method to createBranchTransaction

func (*BranchRegisterRequest) Type

func (msg *BranchRegisterRequest) Type() uint16

Type returns message type

type BranchRegisterResponse

type BranchRegisterResponse struct {
	BranchID uint64
	// contains filtered or unexported fields
}

BranchRegisterResponse register a branch transaction response

func AcquireBranchRegisterResponse

func AcquireBranchRegisterResponse() *BranchRegisterResponse

AcquireBranchRegisterResponse acquire a value from pool

func (*BranchRegisterResponse) BatchEncode

func (msg *BranchRegisterResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*BranchRegisterResponse) Decode

func (msg *BranchRegisterResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchRegisterResponse) Encode

func (msg *BranchRegisterResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchRegisterResponse) MaybeDecode

func (msg *BranchRegisterResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*BranchRegisterResponse) Type

func (msg *BranchRegisterResponse) Type() uint16

Type returns message type

type BranchReportRequest

type BranchReportRequest struct {
	XID             FragmentXID
	BranchID        uint64
	BranchType      BranchType
	ResourceID      string
	BranchStatus    BranchStatus
	ApplicationData string
}

BranchReportRequest branch transaction report request

func AcquireBranchReportRequest

func AcquireBranchReportRequest() *BranchReportRequest

AcquireBranchReportRequest acquire a value from pool

func (*BranchReportRequest) BatchEncode

func (msg *BranchReportRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*BranchReportRequest) Decode

func (msg *BranchReportRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchReportRequest) Encode

func (msg *BranchReportRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchReportRequest) ToReportBranchStatus

func (msg *BranchReportRequest) ToReportBranchStatus(rmSID string) ReportBranchStatus

ToReportBranchStatus adapter method

func (*BranchReportRequest) Type

func (msg *BranchReportRequest) Type() uint16

Type returns message type

type BranchReportResponse

type BranchReportResponse struct {
	// contains filtered or unexported fields
}

BranchReportResponse report branch transaction status response

func AcquireBranchReportResponse

func AcquireBranchReportResponse() *BranchReportResponse

AcquireBranchReportResponse acquire a value from pool

func (*BranchReportResponse) BatchEncode

func (msg *BranchReportResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*BranchReportResponse) Decode

func (msg *BranchReportResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchReportResponse) Encode

func (msg *BranchReportResponse) Encode() *goetty.ByteBuf

BatchEncode encode message

func (*BranchReportResponse) MaybeDecode

func (msg *BranchReportResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*BranchReportResponse) Type

func (msg *BranchReportResponse) Type() uint16

Type returns message type

type BranchRollbackRequest

type BranchRollbackRequest struct {
	// contains filtered or unexported fields
}

BranchRollbackRequest rollback branch request

func AcquireBranchRollbackRequest

func AcquireBranchRollbackRequest() *BranchRollbackRequest

AcquireBranchRollbackRequest acquire a value from pool

func (*BranchRollbackRequest) BatchEncode

func (msg *BranchRollbackRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*BranchRollbackRequest) Decode

func (msg *BranchRollbackRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchRollbackRequest) Encode

func (msg *BranchRollbackRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchRollbackRequest) MaybeDecode

func (msg *BranchRollbackRequest) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode maybe decode message from byte buffer

func (*BranchRollbackRequest) Type

func (msg *BranchRollbackRequest) Type() uint16

Type returns message type

type BranchRollbackResponse

type BranchRollbackResponse struct {
	// contains filtered or unexported fields
}

BranchRollbackResponse rollback a branch transaction response

func AcquireBranchRollbackResponse

func AcquireBranchRollbackResponse() *BranchRollbackResponse

AcquireBranchRollbackResponse acquire a value from pool

func (*BranchRollbackResponse) BatchEncode

func (msg *BranchRollbackResponse) BatchEncode(buf *goetty.ByteBuf)

func (*BranchRollbackResponse) Decode

func (msg *BranchRollbackResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*BranchRollbackResponse) Encode

func (msg *BranchRollbackResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*BranchRollbackResponse) MaybeDecode

func (msg *BranchRollbackResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode maybe decode message from byte buffer

func (*BranchRollbackResponse) Type

func (msg *BranchRollbackResponse) Type() uint16

Type returns message type

type BranchStatus

type BranchStatus byte

BranchStatus branch transaction status

func (*BranchStatus) Name

func (s *BranchStatus) Name() string

Name returns name of the status

type BranchTransaction

type BranchTransaction struct {
	ID         uint64       `json:"id"`
	GID        uint64       `json:"g"`
	RMSID      string       `json:"r"`
	Resource   string       `json:"rs"`
	LockKeys   []LockKey    `json:"l"`
	StartAt    int64        `json:"s"`
	ReportAt   int64        `json:"ra"`
	NotifyAt   int64        `json:"na"`
	Status     BranchStatus `json:"st"`
	BranchType BranchType   `json:"bt"`

	StartAtTime  time.Time `json:"-"`
	ReportAtTime time.Time `json:"-"`
	NotifyAtTime time.Time `json:"-"`
}

BranchTransaction branch transaction

func (*BranchTransaction) Complete

func (bt *BranchTransaction) Complete() bool

Complete is branch transaction complete

func (*BranchTransaction) PhaseOneCommitted

func (bt *BranchTransaction) PhaseOneCommitted() bool

PhaseOneCommitted is branch transaction has been comitted at phase one

type BranchType

type BranchType byte

BranchType branch type

func (*BranchType) Name

func (t *BranchType) Name() string

Name branch type name

type CreateBranchTransaction

type CreateBranchTransaction struct {
	ResourceID string     `json:"resourceId"`
	RMSID      string     `json:"rmSid"`
	GID        uint64     `json:"gid"`
	LockKeys   []LockKey  `json:"lockKeys"`
	BranchType BranchType `json:"branchType"`
}

CreateBranchTransaction create a branch transaction

type CreateGlobalTransaction

type CreateGlobalTransaction struct {
	Name    string        `json:"name"`
	Creator string        `json:"creator"`
	Proxy   string        `json:"proxy"`
	Timeout time.Duration `json:"timeout,omitempty"`
}

CreateGlobalTransaction create a global

type Error

type Error struct {
	Code byte
}

Error error

func NewErrorFrom

func NewErrorFrom(code byte) *Error

NewErrorFrom return err

func (*Error) Error

func (err *Error) Error() string

Error error

type Fragment

type Fragment struct {
	ID          uint64         `json:"id"`
	Peers       []prophet.Peer `json:"peers"`
	Version     uint64         `json:"version"`
	DisableGrow bool           `json:"disableGrow"`
}

Fragment A shard is a logical processing unit. Each shard handles a certain number of global transactions. Exceeding the processing power of the logical unit, a new shard is generated to process.

type FragmentXID

type FragmentXID struct {
	GID        uint64 `json:"gid"`
	FragmentID uint64 `json:"fid"`
}

FragmentXID fragment xid

func MaybeReadXID

func MaybeReadXID(buf *goetty.ByteBuf) (FragmentXID, bool)

MaybeReadXID maybe read xid value

func NewFragmentXID

func NewFragmentXID(gid, fid uint64) FragmentXID

NewFragmentXID returns fragment xid

func ReadXID

func ReadXID(buf *goetty.ByteBuf) FragmentXID

ReadXID read xid value

type GlobalBeginRequest

type GlobalBeginRequest struct {
	Timeout         int
	TransactionName string
}

GlobalBeginRequest begin a global request

func AcquireGlobalBeginRequest

func AcquireGlobalBeginRequest() *GlobalBeginRequest

AcquireGlobalBeginRequest acquire a value from pool

func (*GlobalBeginRequest) BatchEncode

func (msg *GlobalBeginRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalBeginRequest) Decode

func (msg *GlobalBeginRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalBeginRequest) Encode

func (msg *GlobalBeginRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalBeginRequest) ToCreateGlobalTransaction

func (msg *GlobalBeginRequest) ToCreateGlobalTransaction(creator, proxy string) CreateGlobalTransaction

ToCreateGlobalTransaction returns create info

func (*GlobalBeginRequest) Type

func (msg *GlobalBeginRequest) Type() uint16

Type returns message type

type GlobalBeginResponse

type GlobalBeginResponse struct {
	XID       FragmentXID
	ExtraData string
	// contains filtered or unexported fields
}

GlobalBeginResponse begin a global transaction response

func AcquireGlobalBeginResponse

func AcquireGlobalBeginResponse() *GlobalBeginResponse

AcquireGlobalBeginResponse acquire a value from pool

func (*GlobalBeginResponse) BatchEncode

func (msg *GlobalBeginResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalBeginResponse) Decode

func (msg *GlobalBeginResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalBeginResponse) Encode

func (msg *GlobalBeginResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalBeginResponse) MaybeDecode

func (msg *GlobalBeginResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*GlobalBeginResponse) Type

func (msg *GlobalBeginResponse) Type() uint16

Type returns message type

type GlobalCommitRequest

type GlobalCommitRequest struct {
	// contains filtered or unexported fields
}

GlobalCommitRequest commit global transaction request

func AcquireGlobalCommitRequest

func AcquireGlobalCommitRequest() *GlobalCommitRequest

AcquireGlobalCommitRequest acquire a value from pool

func (*GlobalCommitRequest) BatchEncode

func (msg *GlobalCommitRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*GlobalCommitRequest) Decode

func (msg *GlobalCommitRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalCommitRequest) Encode

func (msg *GlobalCommitRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalCommitRequest) Type

func (msg *GlobalCommitRequest) Type() uint16

Type returns message type

type GlobalCommitResponse

type GlobalCommitResponse struct {
	// contains filtered or unexported fields
}

GlobalCommitResponse commit a global transaction response

func AcquireGlobalCommitResponse

func AcquireGlobalCommitResponse() *GlobalCommitResponse

AcquireGlobalCommitResponse acquire a value from pool

func (*GlobalCommitResponse) BatchEncode

func (msg *GlobalCommitResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalCommitResponse) Decode

func (msg *GlobalCommitResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalCommitResponse) Encode

func (msg *GlobalCommitResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalCommitResponse) Type

func (msg *GlobalCommitResponse) Type() uint16

Type returns message type

type GlobalLockQueryRequest

type GlobalLockQueryRequest struct {
	BranchRegisterRequest
}

GlobalLockQueryRequest query global lock request

func AcquireGlobalLockQueryRequest

func AcquireGlobalLockQueryRequest() *GlobalLockQueryRequest

AcquireGlobalLockQueryRequest acquire a value from pool

func (*GlobalLockQueryRequest) Type

func (msg *GlobalLockQueryRequest) Type() uint16

Type returns message type

type GlobalLockQueryResponse

type GlobalLockQueryResponse struct {
	Lockable bool
	// contains filtered or unexported fields
}

GlobalLockQueryResponse query global lock response

func AcquireGlobalLockQueryResponse

func AcquireGlobalLockQueryResponse() *GlobalLockQueryResponse

AcquireGlobalLockQueryResponse acquire a value from pool

func (*GlobalLockQueryResponse) BatchEncode

func (msg *GlobalLockQueryResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalLockQueryResponse) Decode

func (msg *GlobalLockQueryResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalLockQueryResponse) Encode

func (msg *GlobalLockQueryResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalLockQueryResponse) MaybeDecode

func (msg *GlobalLockQueryResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*GlobalLockQueryResponse) Type

func (msg *GlobalLockQueryResponse) Type() uint16

Type returns message type

type GlobalRollbackRequest

type GlobalRollbackRequest struct {
	// contains filtered or unexported fields
}

GlobalRollbackRequest rollback global transaction request

func AcquireGlobalRollbackRequest

func AcquireGlobalRollbackRequest() *GlobalRollbackRequest

AcquireGlobalRollbackRequest acquire a value from pool

func (*GlobalRollbackRequest) BatchEncode

func (msg *GlobalRollbackRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*GlobalRollbackRequest) Decode

func (msg *GlobalRollbackRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalRollbackRequest) Encode

func (msg *GlobalRollbackRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalRollbackRequest) Type

func (msg *GlobalRollbackRequest) Type() uint16

Type returns message type

type GlobalRollbackResponse

type GlobalRollbackResponse struct {
	// contains filtered or unexported fields
}

GlobalRollbackResponse rollback a global transaction response

func AcquireGlobalRollbackResponse

func AcquireGlobalRollbackResponse() *GlobalRollbackResponse

AcquireGlobalRollbackResponse acquire a value from pool

func (*GlobalRollbackResponse) BatchEncode

func (msg *GlobalRollbackResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalRollbackResponse) Decode

func (msg *GlobalRollbackResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalRollbackResponse) Encode

func (msg *GlobalRollbackResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalRollbackResponse) Type

func (msg *GlobalRollbackResponse) Type() uint16

Type returns message type

type GlobalStatus

type GlobalStatus byte

GlobalStatus global transaction status

func (*GlobalStatus) Name

func (s *GlobalStatus) Name() string

Name returns name of the status

type GlobalStatusRequest

type GlobalStatusRequest struct {
	// contains filtered or unexported fields
}

GlobalStatusRequest global status request

func AcquireGlobalStatusRequest

func AcquireGlobalStatusRequest() *GlobalStatusRequest

AcquireGlobalStatusRequest acquire a value from pool

func (*GlobalStatusRequest) BatchEncode

func (msg *GlobalStatusRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*GlobalStatusRequest) Decode

func (msg *GlobalStatusRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalStatusRequest) Encode

func (msg *GlobalStatusRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalStatusRequest) Type

func (msg *GlobalStatusRequest) Type() uint16

Type returns message type

type GlobalStatusResponse

type GlobalStatusResponse struct {
	// contains filtered or unexported fields
}

GlobalStatusResponse global status response

func AcquireGlobalStatusResponse

func AcquireGlobalStatusResponse() *GlobalStatusResponse

AcquireGlobalStatusResponse acquire a value from pool

func (*GlobalStatusResponse) BatchEncode

func (msg *GlobalStatusResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*GlobalStatusResponse) Decode

func (msg *GlobalStatusResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*GlobalStatusResponse) Encode

func (msg *GlobalStatusResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*GlobalStatusResponse) Type

func (msg *GlobalStatusResponse) Type() uint16

Type returns message type

type GlobalTransaction

type GlobalTransaction struct {
	ID          uint64               `json:"id"`
	Name        string               `json:"n"`
	Timeout     int64                `json:"t"`
	Creator     string               `json:"c"`
	Proxy       string               `json:"p"`
	StartAt     int64                `json:"s"`
	StartAtTime time.Time            `json:"-"`
	Status      GlobalStatus         `json:"st"`
	Action      Action               `json:"a"`
	Branches    []*BranchTransaction `json:"bs"`
}

GlobalTransaction global transaction

func (*GlobalTransaction) Auto

func (t *GlobalTransaction) Auto() bool

Auto returns if all branches is auto

func (*GlobalTransaction) Complete

func (t *GlobalTransaction) Complete() bool

Complete returns true if in global is already complete

func (*GlobalTransaction) MissingReportB

func (t *GlobalTransaction) MissingReportB() []uint64

MissingReportB returns branches that not report phase_1 status

func (*GlobalTransaction) Reported

func (t *GlobalTransaction) Reported() bool

Reported returns if all branch transaction report phase_1 status

func (*GlobalTransaction) TimeoutStatus

func (t *GlobalTransaction) TimeoutStatus() bool

TimeoutStatus returns true if in timeout status

type HBACKMsg

type HBACKMsg struct {
	ID      uint64
	Version uint64
	Peer    prophet.Peer
}

HBACKMsg sharding hb ack message

type HBMsg

type HBMsg struct {
	Frag Fragment
}

HBMsg sharding hb message

type Header struct {
	Flag    uint16
	MsgType uint16
	MsgID   uint64
}

Header seata message header

type HeartbeatMessage

type HeartbeatMessage struct {
}

HeartbeatMessage heart

func (*HeartbeatMessage) BatchEncode

func (msg *HeartbeatMessage) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*HeartbeatMessage) Decode

func (msg *HeartbeatMessage) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*HeartbeatMessage) Encode

func (msg *HeartbeatMessage) Encode() *goetty.ByteBuf

Encode encode message

func (*HeartbeatMessage) Type

func (msg *HeartbeatMessage) Type() uint16

Type message type

type JSONResult

type JSONResult struct {
	Code  int         `json:"code"`
	Value interface{} `json:"value,omitempty"`
}

JSONResult json result

type LockKey

type LockKey struct {
	Namespace string `json:"namespace"`
	Key       string `json:"key"`
}

LockKey lock key

func NewLockKey

func NewLockKey(namespace, key string) LockKey

NewLockKey return lock key

func ParseLockKeys

func ParseLockKeys(value string) ([]LockKey, error)

ParseLockKeys parse lock key

func (*LockKey) Value

func (key *LockKey) Value() []byte

Value returns lock value

type Manual

type Manual struct {
	GID    uint64 `json:"g"`
	Action Action `json:"a"`
}

Manual manual schedule

type MergeResultMessage

type MergeResultMessage struct {
	Msgs []Message
}

MergeResultMessage merge message result

func AcquireMergeResultMessage

func AcquireMergeResultMessage() *MergeResultMessage

AcquireMergeResultMessage acquire a value from pool

func (*MergeResultMessage) BatchEncode

func (msg *MergeResultMessage) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*MergeResultMessage) Decode

func (msg *MergeResultMessage) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*MergeResultMessage) Encode

func (msg *MergeResultMessage) Encode() *goetty.ByteBuf

Encode encode message

func (*MergeResultMessage) Type

func (msg *MergeResultMessage) Type() uint16

Type returns message type

type MergedWarpMessage

type MergedWarpMessage struct {
	Msgs   []Message
	MsgIDs []uint64
}

MergedWarpMessage branch transaction report request

func AcquireMergedWarpMessage

func AcquireMergedWarpMessage() *MergedWarpMessage

AcquireMergedWarpMessage acquire a value from pool

func (*MergedWarpMessage) BatchEncode

func (msg *MergedWarpMessage) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*MergedWarpMessage) Decode

func (msg *MergedWarpMessage) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*MergedWarpMessage) Encode

func (msg *MergedWarpMessage) Encode() *goetty.ByteBuf

Encode encode message

func (*MergedWarpMessage) Type

func (msg *MergedWarpMessage) Type() uint16

Type returns message type

type Message

type Message interface {
	Type() uint16
	Decode(buf *goetty.ByteBuf)
	Encode() *goetty.ByteBuf
	BatchEncode(*goetty.ByteBuf)
}

Message message

type Notify

type Notify struct {
	Resource   string      `json:"r"`
	XID        FragmentXID `json:"x"`
	BID        uint64      `json:"b"`
	Action     Action      `json:"a"`
	BranchType BranchType  `json:"t"`
	// contains filtered or unexported fields
}

Notify notify

func (*Notify) ID

func (nt *Notify) ID() string

ID returns identified id

type NotifyACK

type NotifyACK struct {
	From    string       `json:"f"`
	GID     uint64       `json:"g"`
	BID     uint64       `json:"b"`
	Status  BranchStatus `json:"s"`
	Succeed bool         `json:"su"`
	// contains filtered or unexported fields
}

NotifyACK notify ack

func (*NotifyACK) ID

func (nt *NotifyACK) ID() string

ID returns identified id

type Query

type Query struct {
	Limit  uint64 `json:"limit"`
	After  uint64 `json:"after,omitempty"`
	Name   string `json:"name,omitempty"`
	Status int    `json:"status,omitempty"`
	Action int    `json:"action,omitempty"`
}

Query query condition

func (*Query) Filter

func (q *Query) Filter(value *GlobalTransaction) bool

Filter filter by conditions

type RPCMessage

type RPCMessage struct {
	Header Header
	Body   Message
}

RPCMessage seata rpc message

func AcquireRPCMessage

func AcquireRPCMessage() *RPCMessage

AcquireRPCMessage acquire a value from pool

func AcquireRPCMessageForResponse

func AcquireRPCMessageForResponse(msg *RPCMessage, body Message) *RPCMessage

AcquireRPCMessageForResponse acquire a value from pool

func AcquireRPCMessageForResponseByMsgID

func AcquireRPCMessageForResponseByMsgID(msgID uint64, body Message) *RPCMessage

AcquireRPCMessageForResponseByMsgID acquire a value from pool

type RegisterRMRequest

type RegisterRMRequest struct {
	ResourceIDs string
	// contains filtered or unexported fields
}

RegisterRMRequest register RM request

func AcquireRegisterRMRequest

func AcquireRegisterRMRequest() *RegisterRMRequest

AcquireRegisterRMRequest acquire a value from pool

func (*RegisterRMRequest) BatchEncode

func (msg *RegisterRMRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*RegisterRMRequest) Decode

func (msg *RegisterRMRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*RegisterRMRequest) Encode

func (msg *RegisterRMRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*RegisterRMRequest) MaybeDecode

func (msg *RegisterRMRequest) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*RegisterRMRequest) ToResourceSet

func (msg *RegisterRMRequest) ToResourceSet(proxySID, rmSID string) ResourceManagerSet

ToResourceSet returns resource manager set

func (*RegisterRMRequest) Type

func (msg *RegisterRMRequest) Type() uint16

Type returns message type

type RegisterRMResponse

type RegisterRMResponse struct {
	// contains filtered or unexported fields
}

RegisterRMResponse register RM response

func AcquireRegisterRMResponse

func AcquireRegisterRMResponse() *RegisterRMResponse

AcquireRegisterRMResponse acquire a value from pool

func (*RegisterRMResponse) BatchEncode

func (msg *RegisterRMResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*RegisterRMResponse) Decode

func (msg *RegisterRMResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*RegisterRMResponse) Encode

func (msg *RegisterRMResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*RegisterRMResponse) MaybeDecode

func (msg *RegisterRMResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*RegisterRMResponse) Type

func (msg *RegisterRMResponse) Type() uint16

Type returns message type

type RegisterTMRequest

type RegisterTMRequest struct {
	// contains filtered or unexported fields
}

RegisterTMRequest register TM request

func AcquireRegisterTMRequest

func AcquireRegisterTMRequest() *RegisterTMRequest

AcquireRegisterTMRequest acquire a value from pool

func (*RegisterTMRequest) BatchEncode

func (msg *RegisterTMRequest) BatchEncode(buf *goetty.ByteBuf)

BatchEncode batch encode

func (*RegisterTMRequest) Decode

func (msg *RegisterTMRequest) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*RegisterTMRequest) Encode

func (msg *RegisterTMRequest) Encode() *goetty.ByteBuf

Encode encode message

func (*RegisterTMRequest) MaybeDecode

func (msg *RegisterTMRequest) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode maybe decode message from byte buffer

func (*RegisterTMRequest) Type

func (msg *RegisterTMRequest) Type() uint16

Type returns message type

type RegisterTMResponse

type RegisterTMResponse struct {
	// contains filtered or unexported fields
}

RegisterTMResponse register TM response

func AcquireRegisterTMResponse

func AcquireRegisterTMResponse() *RegisterTMResponse

AcquireRegisterTMResponse acquire a value from pool

func (*RegisterTMResponse) BatchEncode

func (msg *RegisterTMResponse) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*RegisterTMResponse) Decode

func (msg *RegisterTMResponse) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*RegisterTMResponse) Encode

func (msg *RegisterTMResponse) Encode() *goetty.ByteBuf

Encode encode message

func (*RegisterTMResponse) MaybeDecode

func (msg *RegisterTMResponse) MaybeDecode(buf *goetty.ByteBuf) bool

MaybeDecode decode message from byte buffer

func (*RegisterTMResponse) Type

func (msg *RegisterTMResponse) Type() uint16

Type returns message type

type RemoveMsg

type RemoveMsg struct {
	ID uint64
}

RemoveMsg remove msg

type ReportBranchStatus

type ReportBranchStatus struct {
	ResourceID string       `json:"resourceId"`
	GID        uint64       `json:"gid"`
	BID        uint64       `json:"bid"`
	Status     BranchStatus `json:"status"`
	RMSID      string       `json:"from"`
}

ReportBranchStatus report branch status

type ResourceManager

type ResourceManager struct {
	Resource string    `json:"r"`
	ProxySID string    `json:"ps"`
	RMSID    string    `json:"cs"`
	LastHB   time.Time `json:"-"`
}

ResourceManager the resource manager

func (*ResourceManager) Tag

func (rm *ResourceManager) Tag() string

Tag returns rm tag

type ResourceManagerSet

type ResourceManagerSet struct {
	ResourceManagers []ResourceManager `json:"rms"`
}

ResourceManagerSet the resource manager set

type RetryNotLeaderMessage

type RetryNotLeaderMessage struct {
	FID            uint64
	NewLeader      uint64
	NewLeaderStore uint64
	RetryData      []byte
}

RetryNotLeaderMessage not leader

func AcquireRetryNotLeaderMessage

func AcquireRetryNotLeaderMessage() *RetryNotLeaderMessage

AcquireRetryNotLeaderMessage acquire RetryNotLeaderMessage from pool

func (*RetryNotLeaderMessage) BatchEncode

func (msg *RetryNotLeaderMessage) BatchEncode(buf *goetty.ByteBuf)

BatchEncode encode message

func (*RetryNotLeaderMessage) Decode

func (msg *RetryNotLeaderMessage) Decode(buf *goetty.ByteBuf)

Decode decode message from byte buffer

func (*RetryNotLeaderMessage) Encode

func (msg *RetryNotLeaderMessage) Encode() *goetty.ByteBuf

Encode encode message

func (*RetryNotLeaderMessage) Type

func (msg *RetryNotLeaderMessage) Type() uint16

Type message type

type RouteableMessage

type RouteableMessage struct {
	// ToStore direct send to this store
	ToStore uint64
	// RMSID which session
	RMSID string
	// ProxyAddr proxy addr
	ProxyAddr string
	// Seq seq
	Seq uint64
	// FID which fragment
	FID uint64
	// Internal server internal
	Internal bool
	// Batch is in batch
	Batch bool
	// MsgID msgID
	MsgID uint64
	// MsgType msg type
	MsgType uint16
	// Data seata origin message
	Data []byte
}

RouteableMessage wrap seata message for routing

func AcquireRouteableMessageForNotify

func AcquireRouteableMessageForNotify(sid string, msgID uint64, origin Message) *RouteableMessage

AcquireRouteableMessageForNotify acquire a value from pool

func AcquireRouteableMessageForResponse

func AcquireRouteableMessageForResponse(msg *RouteableMessage, origin Message) *RouteableMessage

AcquireRouteableMessageForResponse acquire a value from pool

func (*RouteableMessage) Encode

func (rm *RouteableMessage) Encode() []byte

Encode returns bytes

func (*RouteableMessage) ReadOriginMsg

func (rm *RouteableMessage) ReadOriginMsg() Message

ReadOriginMsg returns the origin msg

type StoreMeta

type StoreMeta struct {
	ID         uint64         `json:"id"`
	Addr       string         `json:"addr"`
	ClientAddr string         `json:"cliAddr"`
	Labels     []prophet.Pair `json:"lables"`
}

StoreMeta is the container of Fragments

type Summary

type Summary struct {
	ActiveBrchNum  uint64 `json:"activeBrchNum"`
	ActiveTrxNum   uint64 `json:"activeTrxNum"`
	SuccessBrchNum uint64 `json:"successBrchNum"`
	FailedBrchNum  uint64 `json:"failedBrchNum"`
	SuccessTrxNum  uint64 `json:"successTrxNum"`
	FailedTrxNum   uint64 `json:"failedTrxNum"`
}

Summary summary for all transactions

Jump to

Keyboard shortcuts

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