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

package modelupgrader

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

Index

Package Files

manifold.go shim.go worker.go

Variables

var ErrModelRemoved = errors.New("model has been removed")

ErrModelRemoved indicates that this worker was operating on the model that is no longer found.

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run a Worker as configured.

func NewWorker Uses

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

NewWorker returns a worker that ensures that environ/provider schema upgrades are run when the model is first loaded by a controller of a new version. The worker either runs the upgrades or waits for another controller unit to run them, depending on the configuration.

type Config Uses

type Config struct {
    // Facade holds the API facade used by this worker for getting,
    // setting and watching the model's environ version.
    Facade Facade

    // GateUnlocker holds a gate.Unlocker that the worker must call
    // after the model has been successfully upgraded.
    GateUnlocker gate.Unlocker

    // ControllerTag holds the tag of the controller that runs this
    // worker.
    ControllerTag names.ControllerTag

    // ModelTag holds the tag of the model to which this worker is
    // scoped.
    ModelTag names.ModelTag

    // Environ holds the Environ used to run upgrade steps, or nil
    // if the worker should wait for upgrade steps to be run by
    // another agent.
    Environ environs.Environ

    // CredentialAPI holds the API facade used to invalidate credential
    // whenever the worker makes cloud calls if credential for this model
    // becomes invalid.
    CredentialAPI common.CredentialAPI

    Logger Logger
}

Config holds the configuration and dependencies 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 {
    ModelEnvironVersion(tag names.ModelTag) (int, error)
    ModelTargetEnvironVersion(tag names.ModelTag) (int, error)
    SetModelEnvironVersion(tag names.ModelTag, v int) error
    SetModelStatus(names.ModelTag, status.Status, string, map[string]interface{}) error
    WatchModelEnvironVersion(tag names.ModelTag) (watcher.NotifyWatcher, error)
}

Facade exposes capabilities required by the worker.

func NewFacade Uses

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

type Logger Uses

type Logger interface {
    Tracef(string, ...interface{})
    Debugf(string, ...interface{})
    Warningf(string, ...interface{})
}

Logger represents the methods used by the worker to log details.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string
    EnvironName   string
    GateName      string
    ControllerTag names.ControllerTag
    ModelTag      names.ModelTag
    Logger        Logger

    NewFacade                    func(base.APICaller) (Facade, error)
    NewWorker                    func(Config) (worker.Worker, error)
    NewCredentialValidatorFacade func(base.APICaller) (common.CredentialAPI, error)
}

ManifoldConfig describes how to configure and construct a Worker, and what registered resources it may depend upon.

Package modelupgrader imports 17 packages (graph) and is imported by 3 packages. Updated 2019-10-21. Refresh now. Tools for package owners.