xa

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TMEndRScan ends a recovery scan.
	TMEndRScan = 0x00800000
	// TMFail disassociates the caller and marks the transaction branch
	// rollback-only.
	TMFail = 0x20000000

	// TMJoin joining existing transaction branch.
	TMJoin = 0x00200000

	// TMNoFlags indicate no flags value is selected.
	TMNoFlags = 0x00000000

	// TMOnePhase using one-phase optimization.
	TMOnePhase = 0x40000000

	// TMResume is resuming association with a suspended transaction branch.
	TMResume = 0x08000000

	// TMStartRScan starts a recovery scan.
	TMStartRScan = 0x01000000

	// TMSuccess disassociates caller from a transaction branch.
	TMSuccess = 0x04000000

	// TMSuspend is suspending (not ending) its association with a transaction branch.
	TMSuspend = 0x02000000

	// XAReadOnly the transaction branch has been read-only and has been committed.
	XAReadOnly = 0x00000003

	// XAOk The transaction work has been prepared normally.
	XAOk = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MysqlXAConn added in v1.2.0

type MysqlXAConn struct {
	driver.Conn
}

func NewMysqlXaConn added in v1.2.0

func NewMysqlXaConn(conn driver.Conn) *MysqlXAConn

func (*MysqlXAConn) Commit added in v1.2.0

func (c *MysqlXAConn) Commit(ctx context.Context, xid string, onePhase bool) error

func (*MysqlXAConn) End added in v1.2.0

func (c *MysqlXAConn) End(ctx context.Context, xid string, flags int) error

func (*MysqlXAConn) Forget added in v1.2.0

func (c *MysqlXAConn) Forget(ctx context.Context, xid string) error

func (*MysqlXAConn) GetTransactionTimeout added in v1.2.0

func (c *MysqlXAConn) GetTransactionTimeout() time.Duration

func (*MysqlXAConn) IsSameRM added in v1.2.0

func (c *MysqlXAConn) IsSameRM(ctx context.Context, xares XAResource) bool

IsSameRM is called to determine if the resource manager instance represented by the target object is the same as the resource manager instance represented by the parameter xares.

func (*MysqlXAConn) Recover added in v1.2.0

func (c *MysqlXAConn) Recover(ctx context.Context, flag int) (xids []string, err error)

Recover Obtains a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.

func (*MysqlXAConn) Rollback added in v1.2.0

func (c *MysqlXAConn) Rollback(ctx context.Context, xid string) error

func (*MysqlXAConn) SetTransactionTimeout added in v1.2.0

func (c *MysqlXAConn) SetTransactionTimeout(duration time.Duration) bool

func (*MysqlXAConn) Start added in v1.2.0

func (c *MysqlXAConn) Start(ctx context.Context, xid string, flags int) error

func (*MysqlXAConn) XAPrepare added in v1.2.0

func (c *MysqlXAConn) XAPrepare(ctx context.Context, xid string) error

type OracleXAConn added in v1.2.0

type OracleXAConn struct {
	driver.Conn
}

func (*OracleXAConn) Commit added in v1.2.0

func (c *OracleXAConn) Commit(xid string, onePhase bool) error

func (*OracleXAConn) End added in v1.2.0

func (c *OracleXAConn) End(xid string, flags int) error

func (*OracleXAConn) Forget added in v1.2.0

func (c *OracleXAConn) Forget(xid string) error

func (*OracleXAConn) GetTransactionTimeout added in v1.2.0

func (c *OracleXAConn) GetTransactionTimeout() time.Duration

func (*OracleXAConn) IsSameRM added in v1.2.0

func (c *OracleXAConn) IsSameRM(resource XAResource) bool

func (*OracleXAConn) Recover added in v1.2.0

func (c *OracleXAConn) Recover(flag int) []string

func (*OracleXAConn) Rollback added in v1.2.0

func (c *OracleXAConn) Rollback(xid string) error

func (*OracleXAConn) SetTransactionTimeout added in v1.2.0

func (c *OracleXAConn) SetTransactionTimeout(duration time.Duration) bool

func (*OracleXAConn) Start added in v1.2.0

func (c *OracleXAConn) Start(xid string, flags int) error

func (*OracleXAConn) XAPrepare added in v1.2.0

func (c *OracleXAConn) XAPrepare(xid string) (int, error)

type XAResource added in v1.2.0

type XAResource interface {
	Commit(ctx context.Context, xid string, onePhase bool) error
	End(ctx context.Context, xid string, flags int) error
	Forget(ctx context.Context, xid string) error
	GetTransactionTimeout() time.Duration
	IsSameRM(ctx context.Context, resource XAResource) bool
	XAPrepare(ctx context.Context, xid string) error
	Recover(ctx context.Context, flag int) ([]string, error)
	Rollback(ctx context.Context, xid string) error
	SetTransactionTimeout(duration time.Duration) bool
	Start(ctx context.Context, xid string, flags int) error
}

func CreateXAResource added in v1.2.0

func CreateXAResource(conn driver.Conn, dbType types.DBType) (XAResource, error)

CreateXAResource create a connection for xa with the different db type. Such as mysql, oracle, MARIADB, POSTGRESQL

Jump to

Keyboard shortcuts

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