model

package
v0.0.0-...-0a82276 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

View Source
const ErrRemoved = errors.ConstError("model removed")

ErrRemoved may be returned by some worker started from Manifolds to indicate that the model under management no longer exists.

Variables

This section is empty.

Functions

func CAASManifolds

func CAASManifolds(config ManifoldsConfig) dependency.Manifolds

CAASManifolds returns a set of interdependent dependency manifolds that will run together to administer a CAAS model, as configured.

func IAASManifolds

func IAASManifolds(config ManifoldsConfig) dependency.Manifolds

IAASManifolds returns a set of interdependent dependency manifolds that will run together to administer an IAAS model, as configured.

func IgnoreErrRemoved

func IgnoreErrRemoved(err error) error

IgnoreErrRemoved returns nil if passed an error caused by ErrRemoved, and otherwise returns the original error.

func IsFatal

func IsFatal(err error) bool

IsFatal will probably be helpful when configuring a dependency.Engine to run the result of Manifolds.

func LifeFilter

func LifeFilter(err error) error

LifeFilter is used with the lifeflag manifolds -- which do not depend on runFlag -- to return appropriate errors for consumption by the enclosing dependency.Engine (and/or its IsFatal check).

func WorstError

func WorstError(err, _ error) error

WorstError will probably be helpful when configuring a dependency.Engine to run the result of Manifolds.

func WrapAgent

func WrapAgent(a agent.Agent, controllerUUID, modelUUID string) (agent.Agent, error)

WrapAgent wraps an agent.Agent (expected to be a machine agent, fwiw) such that its references the supplied model rather than the controller model; its config is immutable; and it doesn't use OldPassword.

It's a strong sign that the agent package needs some work...

Types

type ManifoldsConfig

type ManifoldsConfig struct {
	// Agent identifies, and exposes configuration for, the controller
	// machine running these manifolds and the model the manifolds
	// should administer.
	//
	// You should almost certainly set this value to one created by
	// model.WrapAgent.
	Agent coreagent.Agent

	// AgentConfigChanged will be set whenever the agent's api config
	// is updated
	AgentConfigChanged *voyeur.Value

	Authority pki.Authority

	// Clock supplies timing services to any manifolds that need them.
	// Only a few workers have been converted to use them fo far.
	Clock clock.Clock

	// LoggingContext holds the model writers so that the loggers
	// for the workers running on behalf of other models get their logs
	// written into the model's logging collection rather than the controller's.
	LoggingContext corelogger.LoggerContext

	// RunFlagDuration defines for how long this controller will ask
	// for model administration rights; most of the workers controlled
	// by this agent will only be started when the run flag is known
	// to be held.
	RunFlagDuration time.Duration

	// CharmRevisionUpdateInterval determines how often the charm-
	// revision worker will check for new revisions of known charms.
	CharmRevisionUpdateInterval time.Duration

	// StatusHistoryPruner* values control status-history pruning
	// behaviour.
	StatusHistoryPrunerInterval time.Duration

	// ActionPrunerInterval controls the rate at which the action pruner
	// worker is run.
	ActionPrunerInterval time.Duration

	// NewEnvironFunc is a function opens a provider "environment"
	// (typically environs.New).
	NewEnvironFunc environs.NewEnvironFunc

	// NewContainerBrokerFunc is a function opens a CAAS provider.
	NewContainerBrokerFunc caas.NewContainerBrokerFunc

	// NewMigrationMaster is called to create a new migrationmaster
	// worker.
	NewMigrationMaster func(migrationmaster.Config) (worker.Worker, error)

	// ProviderServicesGetter is used to access the provider service.
	ProviderServicesGetter modelworkermanager.ProviderServicesGetter

	// DomainServices is used to access the domain services.
	DomainServices services.DomainServices
}

ManifoldsConfig holds the dependencies and configuration options for a model agent: that is, for the set of interdependent workers that observe and manipulate a single model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL