core

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyTransactionCoordinator

type EmptyTransactionCoordinator struct {
}

EmptyTransactionCoordinator do nothing TransactionCoordinator

func (*EmptyTransactionCoordinator) ActiveGCount

func (tc *EmptyTransactionCoordinator) ActiveGCount() int

ActiveGCount empty implementation

func (*EmptyTransactionCoordinator) BranchTransactionNotifyACK

func (tc *EmptyTransactionCoordinator) BranchTransactionNotifyACK(ack meta.NotifyACK)

BranchTransactionNotifyACK empty implementation

func (*EmptyTransactionCoordinator) ChangeLeaderTo

func (tc *EmptyTransactionCoordinator) ChangeLeaderTo(id uint64)

ChangeLeaderTo empty implementation

func (*EmptyTransactionCoordinator) CommitGlobalTransaction

func (tc *EmptyTransactionCoordinator) CommitGlobalTransaction(gid uint64, who string, cb func(meta.GlobalStatus, error))

CommitGlobalTransaction empty implementation

func (*EmptyTransactionCoordinator) CurrentLeader

func (tc *EmptyTransactionCoordinator) CurrentLeader() (uint64, error)

CurrentLeader empty implementation

func (*EmptyTransactionCoordinator) GlobalTransactionStatus

func (tc *EmptyTransactionCoordinator) GlobalTransactionStatus(gid uint64, cb func(meta.GlobalStatus, error))

GlobalTransactionStatus empty implementation

func (*EmptyTransactionCoordinator) HandleEvent

func (tc *EmptyTransactionCoordinator) HandleEvent() bool

HandleEvent empty implementation

func (*EmptyTransactionCoordinator) HandleManual

func (tc *EmptyTransactionCoordinator) HandleManual()

HandleManual empty implementation

func (*EmptyTransactionCoordinator) IsLeader

func (tc *EmptyTransactionCoordinator) IsLeader() bool

IsLeader empty implementation

func (*EmptyTransactionCoordinator) Lockable

func (tc *EmptyTransactionCoordinator) Lockable(resource string, gid uint64, lockKeys []meta.LockKey, cb func(bool, error))

Lockable empty implementation

func (*EmptyTransactionCoordinator) RegistryBranchTransaction

func (tc *EmptyTransactionCoordinator) RegistryBranchTransaction(value meta.CreateBranchTransaction, cb func(uint64, error))

RegistryBranchTransaction empty implementation

func (*EmptyTransactionCoordinator) RegistryGlobalTransaction

func (tc *EmptyTransactionCoordinator) RegistryGlobalTransaction(value meta.CreateGlobalTransaction, cb func(uint64, error))

RegistryGlobalTransaction empty implementation

func (*EmptyTransactionCoordinator) ReportBranchTransactionStatus

func (tc *EmptyTransactionCoordinator) ReportBranchTransactionStatus(value meta.ReportBranchStatus, cb func(error))

ReportBranchTransactionStatus empty implementation

func (*EmptyTransactionCoordinator) RollbackGlobalTransaction

func (tc *EmptyTransactionCoordinator) RollbackGlobalTransaction(gid uint64, who string, cb func(meta.GlobalStatus, error))

RollbackGlobalTransaction empty implementation

func (*EmptyTransactionCoordinator) Stop

func (tc *EmptyTransactionCoordinator) Stop()

Stop empty implementation

type ManualAPI

type ManualAPI interface {
	// Commit commit global transaction
	Commit(fid, gid uint64) error

	// Rollback rollback global transaction
	Rollback(fid, gid uint64) error
}

ManualAPI manual api

func NewManualAPI

func NewManualAPI(storage storage.Storage) ManualAPI

NewManualAPI returns query API

type Option

type Option func(*options)

Option option

func WithACKTimeout

func WithACKTimeout(value time.Duration) Option

WithACKTimeout set ackTimeout times

func WithCommitIfAllBranchSucceedInPhaseOne

func WithCommitIfAllBranchSucceedInPhaseOne(value bool) Option

WithCommitIfAllBranchSucceedInPhaseOne set commitIfAllBranchSucceedInPhaseOne

func WithConcurrency

func WithConcurrency(concurrency int) Option

WithConcurrency set concurrcy

func WithElector

func WithElector(value election.Elector) Option

WithElector set elector

func WithElectorOptions

func WithElectorOptions(value ...election.Option) Option

WithElectorOptions set leader elector options

func WithIDGenerator

func WithIDGenerator(value id.Generator) Option

WithIDGenerator set id generator

func WithStatusChangeAware

func WithStatusChangeAware(becomeLeader, becomeFollower func()) Option

WithStatusChangeAware set leader follow handler

func WithStorage

func WithStorage(value storage.Storage) Option

WithStorage set meta storage options

func WithTransactionTimeout

func WithTransactionTimeout(value time.Duration) Option

WithTransactionTimeout set transaction timeout

type QueryAPI

type QueryAPI interface {
	// CountTransactions returns transaction count
	CountTransactions(fid uint64) (uint64, error)

	// Transactions returns a transaction list
	Transactions(fid uint64, query meta.Query) ([]meta.GlobalTransaction, error)

	// Transaction returns the spec transaction
	Transaction(fid uint64, gid uint64) (*meta.GlobalTransaction, error)
}

QueryAPI query api

func NewQueryAPI

func NewQueryAPI(storage storage.Storage) QueryAPI

NewQueryAPI returns query API

type TransactionCoordinator

type TransactionCoordinator interface {
	// Stop stop tc
	Stop()

	// ActiveGCount returns number of the actived global transaction
	ActiveGCount() int

	// IsLeader returns true if current node is leader
	IsLeader() bool

	// ChangeLeaderTo change leader to the spec peer
	ChangeLeaderTo(id uint64)

	// CurrentLeader returns the current leader
	CurrentLeader() (uint64, error)

	// HandleEvent process event
	// return false if no event
	HandleEvent() bool

	// HandleManual process manual requests
	HandleManual()

	// RegistryGlobalTransaction registry a global transaction
	RegistryGlobalTransaction(value meta.CreateGlobalTransaction, cb func(uint64, error))

	// RegistryBranchTransaction registry a branch transaction
	RegistryBranchTransaction(value meta.CreateBranchTransaction, cb func(uint64, error))

	// ReportBranchTransactionStatus report branch transaction status, phase one
	ReportBranchTransactionStatus(value meta.ReportBranchStatus, cb func(error))

	// GlobalTransactionStatus return global status
	GlobalTransactionStatus(gid uint64, cb func(meta.GlobalStatus, error))

	// CommitGlobalTransaction commit global
	CommitGlobalTransaction(gid uint64, who string, cb func(meta.GlobalStatus, error))

	// RollbackGlobalTransaction rollback global
	RollbackGlobalTransaction(gid uint64, who string, cb func(meta.GlobalStatus, error))

	// BranchTransactionNotifyACK branch transaction commit/rollback result ack
	BranchTransactionNotifyACK(ack meta.NotifyACK)

	// Lockable returns true if can be locked
	Lockable(resource string, gid uint64, lockKeys []meta.LockKey, cb func(bool, error))
}

TransactionCoordinator Seata transaction manager

func NewTransactionCoordinator

func NewTransactionCoordinator(id, peerID uint64, trans transport.Transport, opts ...Option) (TransactionCoordinator, error)

NewTransactionCoordinator create a transaction coordinator using spec options

Jump to

Keyboard shortcuts

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