This section is empty.


View Source
var NewResumer = func(config Config) (*Resumer, error) {
	if err := config.Validate(); err != nil {
		return nil, errors.Trace(err)
	rr := &Resumer{config: config}
	err := catacomb.Invoke(catacomb.Plan{
		Site: &rr.catacomb,
		Work: rr.loop,
	if err != nil {
		return nil, errors.Trace(err)
	return rr, nil

NewResumer returns a new Resumer or an error. If the Resumer is not nil, the caller is responsible for stopping it via `Kill()` and handling any error returned from `Wait()`.


func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs a resumer worker, using the resources named or defined in the supplied config.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker returns a useful live implementation for ManifoldConfig.NewWorker.


type Config

type Config struct {
	Facade   Facade
	Clock    clock.Clock
	Interval time.Duration

Config holds the dependencies and configuration necessary to drive a Resumer.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if config cannot be expected to drive a Resumer.

type Facade

type Facade interface {

	// ResumeTransactions resumes all pending transactions.
	ResumeTransactions() error

Facade defines the interface for types capable of resuming transactions.

func NewFacade

func NewFacade(apiCaller base.APICaller) (Facade, error)

NewFacade returns a useful live implementation for ManifoldConfig.NewFacade.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	Clock         clock.Clock
	Interval      time.Duration
	NewFacade     func(base.APICaller) (Facade, error)
	NewWorker     func(Config) (worker.Worker, error)

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type Resumer

type Resumer struct {
	// contains filtered or unexported fields

Resumer is responsible for periodically resuming all pending transactions.

func (*Resumer) Kill

func (rr *Resumer) Kill()

Kill is part of the worker.Worker interface.

func (*Resumer) Wait

func (rr *Resumer) Wait() error

Wait is part of the worker.Worker interface.