storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	LeaderElection(applicationID string) bool
	AddGlobalSession(ctx context.Context, globalSession *api.GlobalSession) error
	AddBranchSession(ctx context.Context, branchSession *api.BranchSession) error
	GlobalCommit(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
	GlobalRollback(ctx context.Context, xid string) (api.GlobalSession_GlobalStatus, error)
	GetGlobalSession(ctx context.Context, xid string) (*api.GlobalSession, error)
	ListGlobalSession(ctx context.Context, applicationID string) ([]*api.GlobalSession, error)
	DeleteGlobalSession(ctx context.Context, xid string) error
	GetBranchSession(ctx context.Context, branchID string) (*api.BranchSession, error)
	ListBranchSession(ctx context.Context, applicationID string) ([]*api.BranchSession, error)
	DeleteBranchSession(ctx context.Context, branchID string) error
	GetBranchSessionKeys(ctx context.Context, xid string) ([]string, error)
	BranchReport(ctx context.Context, branchID string, status api.BranchSession_BranchStatus) error
	IsLockable(ctx context.Context, resourceID string, lockKey string) (bool, error)
	IsLockableWithXID(ctx context.Context, resourceID string, lockKey string, xid string) (bool, error)
	ReleaseLockKeys(ctx context.Context, resourceID string, lockKeys []string) (bool, error)
	SetBranchSessionDead(ctx context.Context, branchSession *api.BranchSession) error
	ListDeadBranchSession(ctx context.Context, applicationID string) ([]*api.BranchSession, error)
	WatchGlobalSessions(ctx context.Context, applicationID string) Watcher
	WatchBranchSessions(ctx context.Context, applicationID string) Watcher
}

type TransactionSession

type TransactionSession interface {
	Marshal() (data []byte, err error)
	Unmarshal(data []byte) error
}

type Watcher

type Watcher interface {
	// Stop watching. Will close the channel returned by ResultChan(). Releases
	// any resources used by the watch.
	Stop()

	// ResultChan return a chan which will receive all the TransactionSessions. If an error occurs
	// or Stop() is called, the implementation will close this channel and
	// release any resources used by the watch.
	ResultChan() <-chan TransactionSession
}

Watcher can be implemented by anything that knows how to watch and report changes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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