juju: github.com/juju/juju/worker/migrationflag Index | Files

package migrationflag

import "github.com/juju/juju/worker/migrationflag"


Package Files

manifold.go shim.go worker.go


var ErrChanged = errors.New("migration flag value changed")

ErrChanged indicates that a Worker has stopped because its Check result is no longer valid.

func IsTerminal Uses

func IsTerminal(phase migration.Phase) bool

IsTerminal returns true when the given phase means a migration has finished (successfully or otherwise).

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold packages a Worker for use in a dependency.Engine.

func NewWorker Uses

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

NewWorker creates a *Worker and returns it as a worker.Worker.

type Config Uses

type Config struct {
    Facade Facade
    Model  string
    Check  Predicate

Config holds the dependencies and configuration for a Worker.

func (Config) Validate Uses

func (config Config) Validate() error

Validate returns an error if the config cannot be expected to drive a functional Worker.

type Facade Uses

type Facade interface {
    Watch(uuid string) (watcher.NotifyWatcher, error)
    Phase(uuid string) (migration.Phase, error)

Facade exposes controller functionality required by a Worker.

func NewFacade Uses

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

NewFacade creates a *migrationflag.Facade and returns it as a Facade.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string
    Check         Predicate

    NewFacade func(base.APICaller) (Facade, error)
    NewWorker func(Config) (worker.Worker, error)

ManifoldConfig holds the dependencies and configuration for a Worker manifold.

type Predicate Uses

type Predicate func(migration.Phase) bool

Predicate defines a predicate.

type Worker Uses

type Worker struct {
    // contains filtered or unexported fields

Worker implements worker.Worker and util.Flag, and exits with ErrChanged whenever the result of its configured Check of the Model's migration phase changes.

func New Uses

func New(config Config) (*Worker, error)

New returns a Worker that tracks the result of the configured Check on the Model's migration phase, as exposed by the Facade.

func (*Worker) Check Uses

func (w *Worker) Check() bool

Check is part of the util.Flag interface.

func (*Worker) Kill Uses

func (w *Worker) Kill()

Kill is part of the worker.Worker interface.

func (*Worker) Wait Uses

func (w *Worker) Wait() error

Wait is part of the worker.Worker interface.

Package migrationflag imports 11 packages (graph) and is imported by 63 packages. Updated 2020-05-02. Refresh now. Tools for package owners.