manager

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

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, 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.

type Store

type Store interface {

	// Close the store
	Close() (err error)

	// Has checks if a transaction config exists under the given name
	Has(name string) (exists bool, err error)

	// Get a transaction config from the store
	Get(name string) (config transaction.Config, err error)

	// Set stores the given transaction config
	Set(name string, config transaction.Config) (err error)

	// Delete the transaction config for the given name
	Delete(name string) (err error)

	// Iter iterates the transaction configs applying the callback for the name and config pairs.
	// Returning false causes the iteration to stop.
	Iter(callback func(name string, config transaction.Config) (proceed bool)) (err error)
}

Store for transaction configurations

Jump to

Keyboard shortcuts

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