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

package modelworkermanager

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

Copyright 2017 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.


Package Files

dblogger.go manifold.go modelworkermanager.go shim.go

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run a model worker manager.

func New Uses

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

New starts a new model worker manager.

type Config Uses

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.

func (Config) Validate Uses

func (config Config) Validate() error

Validate returns an error if config cannot be expected to drive a functional model worker manager.

type Controller Uses

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 Uses

type DBLogger interface {
    // Log writes the given log records to the logger's storage.
    Log([]state.LogRecord) error

DBLogger writes into the log collections.

type Logger Uses

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

Logger defines the logging methods used by the worker.

type ManifoldConfig Uses

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 Uses

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type Model Uses

type Model interface {
    MigrationMode() state.MigrationMode
    Type() state.ModelType
    Name() string
    Owner() names.UserTag

Model represents a model.

type ModelLogger Uses

type ModelLogger interface {
    Close() error

ModelLogger is a database backed loggo Writer.

type ModelWatcher Uses

type ModelWatcher interface {
    WatchModels() state.StringsWatcher

ModelWatcher provides an interface for watching the additiona and removal of models.

type NewModelConfig Uses

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 Uses

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 Uses

type StatePoolController struct {

StatePoolController implements Controller in terms of a *state.StatePool.

func (StatePoolController) Config Uses

func (g StatePoolController) Config() (controller.Config, error)

Config is part of the Controller interface.

func (StatePoolController) DBLogger Uses

func (g StatePoolController) DBLogger(modelUUID string) (DBLogger, error)

DBLogger returns a database logger for the specified model.

func (StatePoolController) Model Uses

func (g StatePoolController) Model(modelUUID string) (Model, func(), error)

Model is part of the Controller interface.

Package modelworkermanager imports 19 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.