tm

package
v0.1.10-0...-9bf53c4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_GLOBAL_TX_TIMEOUT = 60000
	DEFAULT_GLOBAL_TX_NAME    = "default"
)

Variables

This section is empty.

Functions

func Implement

func Implement(v GlobalTransactionProxyService)

Types

type DefaultGlobalTransaction

type DefaultGlobalTransaction struct {
	Xid    string
	Status meta.GlobalStatus
	Role   GlobalTransactionRole
	// contains filtered or unexported fields
}

func CreateNew

func CreateNew() *DefaultGlobalTransaction

func GetCurrentOrCreate

func GetCurrentOrCreate(ctx *context2.RootContext) *DefaultGlobalTransaction

func (*DefaultGlobalTransaction) Begin

func (*DefaultGlobalTransaction) BeginWithTimeout

func (gtx *DefaultGlobalTransaction) BeginWithTimeout(timeout int32, ctx *context2.RootContext) error

func (*DefaultGlobalTransaction) BeginWithTimeoutAndName

func (gtx *DefaultGlobalTransaction) BeginWithTimeoutAndName(timeout int32, name string, ctx *context2.RootContext) error

func (*DefaultGlobalTransaction) Commit

func (*DefaultGlobalTransaction) GetLocalStatus

func (gtx *DefaultGlobalTransaction) GetLocalStatus() meta.GlobalStatus

func (*DefaultGlobalTransaction) GetStatus

func (*DefaultGlobalTransaction) GetXid

func (*DefaultGlobalTransaction) GlobalReport

func (gtx *DefaultGlobalTransaction) GlobalReport(globalStatus meta.GlobalStatus, ctx *context2.RootContext) error

func (*DefaultGlobalTransaction) Resume

func (gtx *DefaultGlobalTransaction) Resume(suspendedResourcesHolder *SuspendedResourcesHolder, ctx *context2.RootContext) error

func (*DefaultGlobalTransaction) Rollback

func (gtx *DefaultGlobalTransaction) Rollback(ctx *context2.RootContext) error

func (*DefaultGlobalTransaction) Suspend

type DefaultTransactionManager

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

func (DefaultTransactionManager) Begin

func (manager DefaultTransactionManager) Begin(applicationId string, transactionServiceGroup string, name string, timeout int32) (string, error)

func (DefaultTransactionManager) Commit

func (manager DefaultTransactionManager) Commit(xid string) (meta.GlobalStatus, error)

func (DefaultTransactionManager) GetStatus

func (manager DefaultTransactionManager) GetStatus(xid string) (meta.GlobalStatus, error)

func (DefaultTransactionManager) GlobalReport

func (manager DefaultTransactionManager) GlobalReport(xid string, globalStatus meta.GlobalStatus) (meta.GlobalStatus, error)

func (DefaultTransactionManager) Rollback

func (manager DefaultTransactionManager) Rollback(xid string) (meta.GlobalStatus, error)

type GlobalTransaction

type GlobalTransaction interface {
	Begin(ctx *context2.RootContext) error
	BeginWithTimeout(timeout int32, ctx *context2.RootContext) error
	BeginWithTimeoutAndName(timeout int32, name string, ctx *context2.RootContext) error
	Commit(ctx *context2.RootContext) error
	Rollback(ctx *context2.RootContext) error
	Suspend(unbindXid bool, ctx *context2.RootContext) (*SuspendedResourcesHolder, error)
	Resume(suspendedResourcesHolder *SuspendedResourcesHolder, ctx *context2.RootContext) error
	GetStatus(ctx *context2.RootContext) (meta.GlobalStatus, error)
	GetXid(ctx *context2.RootContext) string
	GlobalReport(globalStatus meta.GlobalStatus, ctx *context2.RootContext) error
	GetLocalStatus() meta.GlobalStatus
}

type GlobalTransactionProxyService

type GlobalTransactionProxyService interface {
	GetProxyService() interface{}
	GetMethodTransactionInfo(methodName string) *TransactionInfo
}

type GlobalTransactionRole

type GlobalTransactionRole byte
const (
	// The Launcher. The one begins the current global transaction.
	Launcher GlobalTransactionRole = iota

	// The Participant. The one just joins into a existing global transaction.
	Participant
)

func (GlobalTransactionRole) String

func (role GlobalTransactionRole) String() string

type Propagation

type Propagation byte
const (
	/**
	 * The REQUIRED.
	 */
	REQUIRED Propagation = iota

	/**
	 * The REQUIRES_NEW.
	 */
	REQUIRES_NEW

	/**
	 * The NOT_SUPPORTED
	 */
	NOT_SUPPORTED

	/**
	 * The SUPPORTS
	 */
	SUPPORTS

	/**
	 * The NEVER
	 */
	NEVER

	/**
	 * The MANDATORY
	 */
	MANDATORY
)

func (Propagation) String

func (t Propagation) String() string

type SuspendedResourcesHolder

type SuspendedResourcesHolder struct {
	Xid string
}

type TransactionInfo

type TransactionInfo struct {
	TimeOut     int32
	Name        string
	Propagation Propagation
}

type TransactionManager

type TransactionManager interface {
	// GlobalStatus_Begin a new global transaction.
	Begin(applicationId string, transactionServiceGroup string, name string, timeout int32) (string, error)

	// Global commit.
	Commit(xid string) (meta.GlobalStatus, error)

	// Global rollback.
	Rollback(xid string) (meta.GlobalStatus, error)

	// Get current status of the give transaction.
	GetStatus(xid string) (meta.GlobalStatus, error)

	// Global report.
	GlobalReport(xid string, globalStatus meta.GlobalStatus) (meta.GlobalStatus, error)
}

Jump to

Keyboard shortcuts

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