Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrModelRemoved = errors.New("model has been removed")
ErrModelRemoved indicates that this worker was operating on the model that is no longer found.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency.Manifold that will run a Worker as configured.
Types ¶
type Config ¶
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.
type Facade ¶
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.
type Logger ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.