dtx

package module
v0.0.0-...-fefbf58 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 11 Imported by: 0

README

dtx

distributed transaction

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec int8
const (
	JSON Codec = iota
	PROTO
)

type Context

type Context struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Context) End

func (c *Context) End()

func (*Context) IsAbout

func (c *Context) IsAbout() bool

func (*Context) Message

func (c *Context) Message() proto.Message

type HandleFunc

type HandleFunc func(*Context) error

type Handler

type Handler interface {
	Commit(c *Context) error
	Rollback(c *Context) error
}

type Option

type Option func(o *Options)

func Debug

func Debug() Option

func SetCodec

func SetCodec(c Codec) Option

type Options

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

type Task

type Task struct {
	ID                     string
	CommitMsg, RollbackMsg proto.Message
	Handler                Handler
	HandleFunc             HandleFunc
}

type Tx

type Tx interface {
	Begin() Tx
	Exec(Task) Tx
	End()
	About(error)
	Rollback(tlog *packet.TxLog) error
}

Tx is pipeline transaction interface.

func New

func New(ctx context.Context, id string, opts ...Option) Tx

New is create transcation pipeline instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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