client

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout timeout error
	ErrTimeout = errors.New("Timeout error")
)

Functions

This section is empty.

Types

type Batch

type Batch interface {
	CreateGlobal(name string, timeout time.Duration)
	RegisterBranch(xid meta.FragmentXID, resource string, branchType meta.BranchType, locks string, applicationData string)
	ReportBranchStatus(xid meta.FragmentXID, bid uint64, status meta.BranchStatus, branchType meta.BranchType, resource string, applicationData string)
	CommitGlobal(xid meta.FragmentXID, extraData string)
	RollbackGlobal(xid meta.FragmentXID, extraData string)
}

Batch batch operation

type Cfg

type Cfg struct {
	Seq               uint64
	Addrs             []string
	HeartbeatDuration time.Duration
	Timeout           time.Duration
	Handler           ResourceHandler

	ApplicationID, Version, ApplicationData string
	Resources                               []string
}

Cfg client cfg

type Client

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

Client seata client

func NewClient

func NewClient(cfg Cfg) *Client

NewClient returns a seata client

func (*Client) BranchCommitACK

func (c *Client) BranchCommitACK(xid meta.FragmentXID, bid uint64, status meta.BranchStatus)

BranchCommitACK ack branch commit

func (*Client) BranchRollbackACK

func (c *Client) BranchRollbackACK(xid meta.FragmentXID, bid uint64, status meta.BranchStatus)

BranchRollbackACK ack branch rollback

func (*Client) CommitBatch

func (c *Client) CommitBatch(batch Batch) ([]meta.Message, error)

CommitBatch commit batch

func (*Client) CommitGlobal

func (c *Client) CommitGlobal(xid meta.FragmentXID, extraData string) error

CommitGlobal commit global transaction

func (*Client) CreateBatch

func (c *Client) CreateBatch() Batch

CreateBatch create batch operation

func (*Client) CreateGlobal

func (c *Client) CreateGlobal(name string, timeout time.Duration) (meta.FragmentXID, error)

CreateGlobal register a global transaction

func (*Client) RegisterBranch

func (c *Client) RegisterBranch(xid meta.FragmentXID, resource string, branchType meta.BranchType, locks string, applicationData string) (uint64, error)

RegisterBranch register a branch transaction

func (*Client) ReportBranchStatus

func (c *Client) ReportBranchStatus(xid meta.FragmentXID, bid uint64, status meta.BranchStatus,
	branchType meta.BranchType, resource string, applicationData string) error

ReportBranchStatus report branch status at phase one

func (*Client) RollbackGlobal

func (c *Client) RollbackGlobal(xid meta.FragmentXID, extraData string) error

RollbackGlobal rollback global transaction

type ResourceHandler

type ResourceHandler interface {
	OnBranchCommit(xid meta.FragmentXID, bid uint64)
	OnBranchRollback(xid meta.FragmentXID, bid uint64)
}

ResourceHandler resource handler

Jump to

Keyboard shortcuts

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