juju: github.com/wallyworld/juju/worker/resumer Index | Files

package resumer

import "github.com/wallyworld/juju/worker/resumer"


Package Files

manifold.go resumer.go shim.go


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 Uses

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 Uses

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

NewWorker returns a useful live implementation for ManifoldConfig.NewWorker.

type Config Uses

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 Uses

func (config Config) Validate() error

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

type Facade Uses

type Facade interface {

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

Facade defines the interface for types capable of resuming transactions.

func NewFacade Uses

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

NewFacade returns a useful live implementation for ManifoldConfig.NewFacade.

type ManifoldConfig Uses

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 Uses

type Resumer struct {
    // contains filtered or unexported fields

Resumer is responsible for periodically resuming all pending transactions.

func (*Resumer) Kill Uses

func (rr *Resumer) Kill()

Kill is part of the worker.Worker interface.

func (*Resumer) Wait Uses

func (rr *Resumer) Wait() error

Wait is part of the worker.Worker interface.

Package resumer imports 12 packages (graph). Updated 2020-07-22. Refresh now. Tools for package owners.