Documentation
¶
Overview ¶
Copyright 2017 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency.Manifold that will run a model worker manager.
Types ¶
type Config ¶
type Config struct {
Authority pki.Authority
Clock clock.Clock
Logger Logger
MachineID string
ModelWatcher ModelWatcher
Mux *apiserverhttp.Mux
Controller Controller
NewModelWorker NewModelWorkerFunc
ErrorDelay time.Duration
}
Config holds the dependencies and configuration necessary to run a model worker manager.
type Controller ¶
type Controller interface {
Config() (controller.Config, error)
Model(modelUUID string) (Model, func(), error)
DBLogger(modelUUID string) (DBLogger, error)
}
Controller provides an interface for getting models by UUID, and other details needed to pass into the function to start workers for a model. Once a model is no longer required, the returned function must be called to dispose of the model.
type DBLogger ¶
type DBLogger interface {
// Log writes the given log records to the logger's storage.
Log([]state.LogRecord) error
Close()
}
DBLogger writes into the log collections.
type ManifoldConfig ¶
type ManifoldConfig struct {
AgentName string
AuthorityName string
StateName string
Clock clock.Clock
MuxName string
NewWorker func(Config) (worker.Worker, error)
NewModelWorker NewModelWorkerFunc
Logger Logger
}
ManifoldConfig holds the information necessary to run a model worker manager in a dependency.Engine.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate validates the manifold configuration.
type Model ¶
type Model interface {
MigrationMode() state.MigrationMode
Type() state.ModelType
Name() string
Owner() names.UserTag
}
Model represents a model.
type ModelLogger ¶
ModelLogger is a database backed loggo Writer.
type ModelWatcher ¶
type ModelWatcher interface {
WatchModels() state.StringsWatcher
}
ModelWatcher provides an interface for watching the additiona and removal of models.
type NewModelConfig ¶
type NewModelConfig struct {
Authority pki.Authority
ModelName string // Use a fully qualified name "<namespace>-<name>"
ModelUUID string
ModelType state.ModelType
ModelLogger ModelLogger
Mux *apiserverhttp.Mux
ControllerConfig controller.Config
}
NewModelConfig holds the information required by the NewModelWorkerFunc to start the workers for the specified model
type NewModelWorkerFunc ¶
type NewModelWorkerFunc func(config NewModelConfig) (worker.Worker, error)
NewModelWorkerFunc should return a worker responsible for running all a model's required workers; and for returning nil when there's no more model to manage.
type StatePoolController ¶
StatePoolController implements Controller in terms of a *state.StatePool.
func (StatePoolController) Config ¶
func (g StatePoolController) Config() (controller.Config, error)
Config is part of the Controller interface.