message

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION = 1

	// MaxFrameLength max frame length
	MaxFrameLength = 8 * 1024 * 1024

	// V1HeadLength v1 head length
	V1HeadLength = 16

	// Request message type
	GettyRequestTypeRequestSync GettyRequestType = 0

	// Response message type
	GettyRequestTypeResponse GettyRequestType = 1

	// Request which no need response
	GettyRequestTypeRequestOneway GettyRequestType = 2

	// Heartbeat Request
	GettyRequestTypeHeartbeatRequest GettyRequestType = 3

	// Heartbeat Response
	GettyRequestTypeHeartbeatResponse GettyRequestType = 4
)
View Source
const (
	ResultCodeFailed  = ResultCode(0)
	ResultCodeSuccess = ResultCode(1)
)

Variables

View Source
var (
	HeartBeatMessagePing = HeartBeatMessage{true}
	HeartBeatMessagePong = HeartBeatMessage{false}
)
View Source
var MagicCodeBytes = [2]byte{0xda, 0xda}

Functions

This section is empty.

Types

type AbstractBranchEndRequest

type AbstractBranchEndRequest struct {
	MessageTypeAware
	Xid             string
	BranchId        int64
	BranchType      model2.BranchType
	ResourceId      string
	ApplicationData []byte
}

type AbstractBranchEndResponse

type AbstractBranchEndResponse struct {
	AbstractTransactionResponse
	Xid          string
	BranchId     int64
	BranchStatus model2.BranchStatus
}

type AbstractGlobalEndRequest

type AbstractGlobalEndRequest struct {
	Xid       string
	ExtraData []byte
}

type AbstractGlobalEndResponse

type AbstractGlobalEndResponse struct {
	AbstractTransactionResponse
	GlobalStatus GlobalStatus
}

type AbstractIdentifyRequest

type AbstractIdentifyRequest struct {
	Version                 string
	ApplicationId           string `json:"applicationId"`
	TransactionServiceGroup string
	ExtraData               []byte
}

type AbstractIdentifyResponse

type AbstractIdentifyResponse struct {
	AbstractResultMessage
	Version    string
	ExtraData  []byte
	Identified bool
}

type AbstractResultMessage

type AbstractResultMessage struct {
	ResultCode ResultCode
	Msg        string
}

type AbstractTransactionResponse

type AbstractTransactionResponse struct {
	AbstractResultMessage
	TransactionErrorCode errors.TransactionErrorCode
}

type BranchCommitRequest

type BranchCommitRequest struct {
	AbstractBranchEndRequest
}

func (BranchCommitRequest) GetTypeCode

func (req BranchCommitRequest) GetTypeCode() MessageType

type BranchCommitResponse

type BranchCommitResponse struct {
	AbstractBranchEndResponse
}

func (BranchCommitResponse) GetTypeCode

func (resp BranchCommitResponse) GetTypeCode() MessageType

type BranchRegisterRequest

type BranchRegisterRequest struct {
	Xid             string
	BranchType      model2.BranchType
	ResourceId      string
	LockKey         string
	ApplicationData []byte
}

func (BranchRegisterRequest) GetTypeCode

func (req BranchRegisterRequest) GetTypeCode() MessageType

type BranchRegisterResponse

type BranchRegisterResponse struct {
	AbstractTransactionResponse
	BranchId int64
}

func (BranchRegisterResponse) GetTypeCode

func (resp BranchRegisterResponse) GetTypeCode() MessageType

type BranchReportRequest

type BranchReportRequest struct {
	Xid             string
	BranchId        int64
	ResourceId      string
	Status          model2.BranchStatus
	ApplicationData []byte
	BranchType      model2.BranchType
}

func (BranchReportRequest) GetTypeCode

func (req BranchReportRequest) GetTypeCode() MessageType

type BranchReportResponse

type BranchReportResponse struct {
	AbstractTransactionResponse
}

func (BranchReportResponse) GetTypeCode

func (resp BranchReportResponse) GetTypeCode() MessageType

type BranchRollbackRequest

type BranchRollbackRequest struct {
	AbstractBranchEndRequest
}

func (BranchRollbackRequest) GetTypeCode

func (req BranchRollbackRequest) GetTypeCode() MessageType

type BranchRollbackResponse

type BranchRollbackResponse struct {
	AbstractBranchEndResponse
}

func (BranchRollbackResponse) GetTypeCode

func (resp BranchRollbackResponse) GetTypeCode() MessageType

type GettyRequestType

type GettyRequestType byte

type GlobalBeginRequest

type GlobalBeginRequest struct {
	Timeout         time.Duration
	TransactionName string
}

func (GlobalBeginRequest) GetTypeCode

func (req GlobalBeginRequest) GetTypeCode() MessageType

type GlobalBeginResponse

type GlobalBeginResponse struct {
	AbstractTransactionResponse

	Xid       string
	ExtraData []byte
}

func (GlobalBeginResponse) GetTypeCode

func (resp GlobalBeginResponse) GetTypeCode() MessageType

type GlobalCommitRequest

type GlobalCommitRequest struct {
	AbstractGlobalEndRequest
}

func (GlobalCommitRequest) GetTypeCode

func (req GlobalCommitRequest) GetTypeCode() MessageType

type GlobalCommitResponse

type GlobalCommitResponse struct {
	AbstractGlobalEndResponse
}

func (GlobalCommitResponse) GetTypeCode

func (resp GlobalCommitResponse) GetTypeCode() MessageType

type GlobalLockQueryRequest

type GlobalLockQueryRequest struct {
	BranchRegisterRequest
}

func (GlobalLockQueryRequest) GetTypeCode

func (req GlobalLockQueryRequest) GetTypeCode() MessageType

type GlobalLockQueryResponse

type GlobalLockQueryResponse struct {
	AbstractTransactionResponse

	Lockable bool
}

func (GlobalLockQueryResponse) GetTypeCode

func (resp GlobalLockQueryResponse) GetTypeCode() MessageType

type GlobalReportRequest

type GlobalReportRequest struct {
	AbstractGlobalEndRequest

	GlobalStatus GlobalStatus
}

func (GlobalReportRequest) GetTypeCode

func (req GlobalReportRequest) GetTypeCode() MessageType

type GlobalReportResponse

type GlobalReportResponse struct {
	AbstractGlobalEndResponse
}

func (GlobalReportResponse) GetTypeCode

func (resp GlobalReportResponse) GetTypeCode() MessageType

type GlobalRollbackRequest

type GlobalRollbackRequest struct {
	AbstractGlobalEndRequest
}

func (GlobalRollbackRequest) GetTypeCode

func (req GlobalRollbackRequest) GetTypeCode() MessageType

type GlobalRollbackResponse

type GlobalRollbackResponse struct {
	AbstractGlobalEndResponse
}

func (GlobalRollbackResponse) GetTypeCode

func (resp GlobalRollbackResponse) GetTypeCode() MessageType

type GlobalStatus

type GlobalStatus byte
const (

	/**
	 * Un known global status.
	 */
	// Unknown
	GlobalStatusUnKnown GlobalStatus = 0

	/**
	 * The GlobalStatusBegin.
	 */
	// PHASE 1: can accept new branch registering.
	GlobalStatusBegin GlobalStatus = 1

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

	/**
	 * The Commit retrying.
	 */
	// Retrying commit after a recoverable failure.
	GlobalStatusCommitRetrying GlobalStatus = 3

	/**
	 * Rollbacking global status.
	 */
	// Rollbacking
	GlobalStatusRollbacking GlobalStatus = 4

	/**
	 * The Rollback retrying.
	 */
	// Retrying rollback after a recoverable failure.
	GlobalStatusRollbackRetrying GlobalStatus = 5

	/**
	 * The Timeout rollbacking.
	 */
	// Rollbacking since timeout
	GlobalStatusTimeoutRollbacking GlobalStatus = 6

	/**
	 * The Timeout rollback retrying.
	 */
	// Retrying rollback  GlobalStatus = since timeout) after a recoverable failure.
	GlobalStatusTimeoutRollbackRetrying GlobalStatus = 7

	/**
	 * All branches can be async committed. The committing is NOT done yet, but it can be seen as committed for TM/RM
	 * client.
	 */
	GlobalStatusAsyncCommitting GlobalStatus = 8

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

	/**
	 * The Commit failed.
	 */
	// Finally: failed to commit
	GlobalStatusCommitFailed GlobalStatus = 10

	/**
	 * The Rollbacked.
	 */
	// Finally: global transaction is successfully rollbacked.
	GlobalStatusRollbacked GlobalStatus = 11

	/**
	 * The Rollback failed.
	 */
	// Finally: failed to rollback
	GlobalStatusRollbackFailed GlobalStatus = 12

	/**
	 * The Timeout rollbacked.
	 */
	// Finally: global transaction is successfully rollbacked since timeout.
	GlobalStatusTimeoutRollbacked GlobalStatus = 13

	/**
	 * The Timeout rollback failed.
	 */
	// Finally: failed to rollback since timeout
	GlobalStatusTimeoutRollbackFailed GlobalStatus = 14

	/**
	 * The Finished.
	 */
	// Not managed in session MAP any more
	GlobalStatusFinished GlobalStatus = 15
)

type GlobalStatusRequest

type GlobalStatusRequest struct {
	AbstractGlobalEndRequest
}

func (GlobalStatusRequest) GetTypeCode

func (req GlobalStatusRequest) GetTypeCode() MessageType

type GlobalStatusResponse

type GlobalStatusResponse struct {
	AbstractGlobalEndResponse
}

func (GlobalStatusResponse) GetTypeCode

func (resp GlobalStatusResponse) GetTypeCode() MessageType

type HeartBeatMessage

type HeartBeatMessage struct {
	Ping bool
}

func (HeartBeatMessage) GetTypeCode

func (resp HeartBeatMessage) GetTypeCode() MessageType

func (HeartBeatMessage) ToString

func (msg HeartBeatMessage) ToString() string

type MergeResultMessage

type MergeResultMessage struct {
	Msgs []MessageTypeAware
}

func (MergeResultMessage) GetTypeCode

func (resp MergeResultMessage) GetTypeCode() MessageType

type MergedWarpMessage

type MergedWarpMessage struct {
	Msgs   []MessageTypeAware
	MsgIds []int32
}

func (MergedWarpMessage) GetTypeCode

func (req MergedWarpMessage) GetTypeCode() MessageType

type MessageFuture

type MessageFuture struct {
	ID       int32
	Err      error
	Response interface{}
	Done     chan struct{}
}

func NewMessageFuture

func NewMessageFuture(message RpcMessage) *MessageFuture

type MessageType

type MessageType int
const (
	/**
	 * The constant TypeGlobalBegin.
	 */
	MessageTypeGlobalBegin MessageType = iota + 1
	/**
	 * The constant TypeGlobalBeginResult.
	 */
	MessageTypeGlobalBeginResult
	/**
	 * The constant TypeBranchCommit.
	 */
	MessageTypeBranchCommit
	/**
	 * The constant TypeBranchCommitResult.
	 */
	MessageTypeBranchCommitResult
	/**
	 * The constant TypeBranchRollback.
	 */
	MessageTypeBranchRollback
	/**
	 * The constant TypeBranchRollbackResult.
	 */
	MessageTypeBranchRollbackResult
	/**
	 * The constant TypeGlobalCommit.
	 */
	MessageTypeGlobalCommit
	/**
	 * The constant TypeGlobalCommitResult.
	 */
	MessageTypeGlobalCommitResult
	/**
	 * The constant TypeGlobalRollback.
	 */
	MessageTypeGlobalRollback
	/**
	 * The constant TypeGlobalRollbackResult.
	 */
	MessageTypeGlobalRollbackResult
	/**
	 * The constant TypeBranchRegister.
	 */
	MessageTypeBranchRegister
	/**
	 * The constant TypeBranchRegisterResult.
	 */
	MessageTypeBranchRegisterResult
	/**
	 * The constant TypeBranchStatusReport.
	 */
	MessageTypeBranchStatusReport
	/**
	 * The constant TypeBranchStatusReportResult.
	 */
	MessageTypeBranchStatusReportResult
	/**
	 * The constant TypeGlobalStatus.
	 */
	MessageTypeGlobalStatus
	/**
	 * The constant TypeGlobalStatusResult.
	 */
	MessageTypeGlobalStatusResult
	/**
	 * The constant TypeGlobalReport.
	 */
	MessageTypeGlobalReport
	/**
	 * The constant TypeGlobalReportResult.
	 */
	MessageTypeGlobalReportResult
	/**
	 * The constant TypeGlobalLockQuery.
	 */
	MessageTypeGlobalLockQuery MessageType = iota + 3
	/**
	 * The constant TypeGlobalLockQueryResult.
	 */
	MessageTypeGlobalLockQueryResult

	/**
	 * The constant TypeSeataMerge.
	 */
	MessageTypeSeataMerge MessageType = iota + 39
	/**
	 * The constant TypeSeataMergeResult.
	 */
	MessageTypeSeataMergeResult

	/**
	 * The constant TypeRegClt.
	 */
	MessageTypeRegClt MessageType = iota + 79
	/**
	 * The constant TypeRegCltResult.
	 */
	MessageTypeRegCltResult
	/**
	 * The constant TypeRegRm.
	 */
	MessageTypeRegRm
	/**
	 * The constant TypeRegRmResult.
	 */
	MessageTypeRegRmResult
	/**
	 * The constant TypeRmDeleteUndolog.
	 */
	MessageTypeRmDeleteUndolog MessageType = iota + 85
	/**
	 * the constant TypeHeartbeatMsg
	 */
	MessageTypeHeartbeatMsg MessageType = iota + 93

	/**
	 * the constant MessageTypeBatchResultMsg
	 */
	MessageTypeBatchResultMsg
)

type MessageTypeAware

type MessageTypeAware interface {
	GetTypeCode() MessageType
}

type RegisterRMRequest

type RegisterRMRequest struct {
	AbstractIdentifyRequest
	ResourceIds string
}

func (RegisterRMRequest) GetTypeCode

func (req RegisterRMRequest) GetTypeCode() MessageType

type RegisterRMResponse

type RegisterRMResponse struct {
	AbstractIdentifyResponse
}

func (RegisterRMResponse) GetTypeCode

func (resp RegisterRMResponse) GetTypeCode() MessageType

type RegisterTMRequest

type RegisterTMRequest struct {
	AbstractIdentifyRequest
}

func (RegisterTMRequest) GetTypeCode

func (req RegisterTMRequest) GetTypeCode() MessageType

type RegisterTMResponse

type RegisterTMResponse struct {
	AbstractIdentifyResponse
}

func (RegisterTMResponse) GetTypeCode

func (resp RegisterTMResponse) GetTypeCode() MessageType

type ResultCode

type ResultCode byte

type RpcMessage

type RpcMessage struct {
	ID         int32
	Type       GettyRequestType
	Codec      byte
	Compressor byte
	HeadMap    map[string]string
	Body       interface{}
}

type UndoLogDeleteRequest

type UndoLogDeleteRequest struct {
	ResourceId string
	SaveDays   MessageType
	BranchType model2.BranchType
}

func (UndoLogDeleteRequest) GetTypeCode

func (req UndoLogDeleteRequest) GetTypeCode() MessageType

Jump to

Keyboard shortcuts

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