manager

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTransactionTimeout if not specified
	DefaultTransactionTimeout = "5m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	Emit(result transaction.Result)
}

Emitter is the interface for result emitters to external systems

type EmitterFunc

type EmitterFunc func(result transaction.Result)

EmitterFunc is a function type that implements Emitter

func (EmitterFunc) Emit

func (e EmitterFunc) Emit(result transaction.Result)

Emit results

type Manager

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

Manager is a manager for replicant transactions. It tracks execution, scheduling and result data.

func New

func New(s store.Store, d ...driver.Driver) (manager *Manager)

New creates a new manager

func (*Manager) Add

func (m *Manager) Add(tx transaction.Transaction) (err error)

Add adds a replicant transaction to the manager and scheduler if the scheduling spec is provided

func (*Manager) AddEmitter

func (m *Manager) AddEmitter(emitter Emitter)

AddEmitter adds the given Emitter to emit result data to external systems

func (*Manager) AddEmitterFunc

func (m *Manager) AddEmitterFunc(emitter func(result transaction.Result))

AddEmitterFunc is like SetEmitter, but it takes a EmitterFunc as input

func (*Manager) AddFromConfig

func (m *Manager) AddFromConfig(config transaction.Config) (err error)

AddFromConfig is like Add but creates the transaction from a transaction.Config

func (*Manager) Close

func (m *Manager) Close() (err error)

Close the manager

func (*Manager) GetResult

func (m *Manager) GetResult(name string) (result transaction.Result, err error)

GetResult fetches the latest result from a managed transaction

func (*Manager) GetResults

func (m *Manager) GetResults() (results []transaction.Result)

GetResults fetches all latest results

func (*Manager) GetTransaction

func (m *Manager) GetTransaction(name string) (tx transaction.Transaction, err error)

GetTransaction fetches a existing transaction from the manager

func (*Manager) GetTransactionConfig

func (m *Manager) GetTransactionConfig(name string) (config transaction.Config, err error)

GetTransactionConfig fetches the config from a managed transaction

func (*Manager) GetTransactionsConfig

func (m *Manager) GetTransactionsConfig() (configs []transaction.Config)

GetTransactionsConfig fetches all transactions definitions from the manager

func (*Manager) New

func (m *Manager) New(config transaction.Config) (tx transaction.Transaction, err error)

New creates a transaction for the given config

func (*Manager) RemoveTransaction

func (m *Manager) RemoveTransaction(name string) (err error)

RemoveTransaction from the manager

func (*Manager) Run

func (m *Manager) Run(ctx context.Context, name string) (result transaction.Result, err error)

Run a managed transaction in a ad-hoc manner.

Jump to

Keyboard shortcuts

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