machine

package
v0.0.0-...-a0d7459 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: AGPL-3.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIWorkersManifold

func APIWorkersManifold(config APIWorkersConfig) dependency.Manifold

APIWorkersManifold starts workers that rely on an API connection using a function provided to it.

This manifold exists to start API workers which have not yet been ported to work directly with the dependency engine. Once all API workers started by StartAPIWorkers have been migrated to the dependency engine, this manifold can be removed.

func Manifolds

func Manifolds(config ManifoldsConfig) dependency.Manifolds

Manifolds returns a set of co-configured manifolds covering the various responsibilities of a machine agent.

Thou Shalt Not Use String Literals In This Function. Or Else.

func ServingInfoSetterManifold

func ServingInfoSetterManifold(config ServingInfoSetterConfig) dependency.Manifold

ServingInfoSetterManifold defines a simple start function which runs after the API connection has come up. If the machine agent is a controller, it grabs the state serving info over the API and records it to agent configuration, and then stops.

func StateWorkersManifold

func StateWorkersManifold(config StateWorkersConfig) dependency.Manifold

StateWorkersManifold starts workers that rely on a *state.State using a function provided to it.

This manifold exists to start State-using workers which have not yet been ported to work directly with the dependency engine. Once all state workers started by StartStateWorkers have been migrated to the dependency engine, this manifold can be removed.

Types

type APIWorkersConfig

type APIWorkersConfig struct {
	APICallerName   string
	StartAPIWorkers func(api.Connection) (worker.Worker, error)
}

APIWorkersConfig provides the dependencies for the apiworkers manifold.

type ManifoldsConfig

type ManifoldsConfig struct {

	// Agent contains the agent that will be wrapped and made available to
	// its dependencies via a dependency.Engine.
	Agent coreagent.Agent

	// AgentConfigChanged is set whenever the machine agent's config
	// is updated.
	AgentConfigChanged *voyeur.Value

	// RootDir is the root directory that any worker that needs to
	// access local filesystems should use as a base. In actual use it
	// will be "" but it may be overriden in tests.
	RootDir string

	// PreviousAgentVersion passes through the version the machine
	// agent was running before the current restart.
	PreviousAgentVersion version.Number

	// UpgradeStepsLock is passed to the upgrade steps gate to
	// coordinate workers that shouldn't do anything until the
	// upgrade-steps worker is done.
	UpgradeStepsLock gate.Lock

	// UpgradeCheckLock is passed to the upgrade check gate to
	// coordinate workers that shouldn't do anything until the
	// upgrader worker completes it's first check.
	UpgradeCheckLock gate.Lock

	// OpenState is function used by the state manifold to create a
	// *state.State.
	OpenState func(coreagent.Config) (*state.State, error)

	// OpenStateForUpgrade is a function the upgradesteps worker can
	// use to establish a connection to state.
	OpenStateForUpgrade func() (*state.State, error)

	// StartStateWorkers is function called by the stateworkers
	// manifold to start workers which rely on a *state.State but
	// which haven't been converted to run directly under the
	// dependency engine yet. This will go once these workers have
	// been converted.
	StartStateWorkers func(*state.State) (worker.Worker, error)

	// StartAPIWorkers is passed to the apiworkers manifold. It starts
	// workers which rely on an API connection (which have not yet
	// been converted to work directly with the dependency engine).
	StartAPIWorkers func(api.Connection) (worker.Worker, error)

	// PreUpgradeSteps is a function that is used by the upgradesteps
	// worker to ensure that conditions are OK for an upgrade to
	// proceed.
	PreUpgradeSteps func(*state.State, coreagent.Config, bool, bool) error

	// LogSource defines the channel type used to send log message
	// structs within the machine agent.
	LogSource logsender.LogRecordCh

	// newDeployContext gives the tests the opportunity to create a deployer.Context
	// that can be used for testing so as to avoid (1) deploying units to the system
	// running the tests and (2) get access to the *State used internally, so that
	// tests can be run without waiting for the 5s watcher refresh time to which we would
	// otherwise be restricted.
	NewDeployContext func(st *apideployer.State, agentConfig coreagent.Config) deployer.Context

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

	// Clock supplies timekeeping services to various workers.
	Clock clock.Clock

	// ValidateMigration is called by the migrationminion during the
	// migration process to check that the agent will be ok when
	// connected to the new target controller.
	ValidateMigration func(base.APICaller) error

	// PrometheusRegisterer is a prometheus.Registerer that may be used
	// by workers to register Prometheus metric collectors.
	PrometheusRegisterer prometheus.Registerer

	// CentralHub is the primary hub that exists in the apiserver.
	CentralHub *pubsub.StructuredHub

	// DepEngineReporter is a dependency engine reporter.
	DepEngineReporter dependency.Reporter
}

ManifoldsConfig allows specialisation of the result of Manifolds.

type ServingInfoSetterConfig

type ServingInfoSetterConfig struct {
	AgentName     string
	APICallerName string
}

ServingInfoSetterConfig provides the dependencies for the servingInfoSetter manifold.

type StateWorkersConfig

type StateWorkersConfig struct {
	StateName         string
	StartStateWorkers func(*state.State) (worker.Worker, error)
}

StateWorkersConfig provides the dependencies for the stateworkers manifold.

Jump to

Keyboard shortcuts

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