deployer

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: 28 Imported by: 0

Documentation

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 runs a deployer worker, using the resource names defined in the supplied config.

func NewDeployer

func NewDeployer(st *apideployer.State, ctx Context) (worker.Worker, error)

NewDeployer returns a Worker that deploys and recalls unit agents via ctx, taking a machine id to operate on.

Types

type APICalls

type APICalls interface {
	ConnectionInfo() (params.DeployerConnectionValues, error)
}

APICalls defines the interface to the API that the simple context needs.

type Context

type Context interface {
	// DeployUnit causes the agent for the specified unit to be started and run
	// continuously until further notice without further intervention. It will
	// return an error if the agent is already deployed.
	DeployUnit(unitName, initialPassword string) error

	// RecallUnit causes the agent for the specified unit to be stopped, and
	// the agent's data to be destroyed. It will return an error if the agent
	// was not deployed by the manager.
	RecallUnit(unitName string) error

	// DeployedUnits returns the names of all units deployed by the manager.
	DeployedUnits() ([]string, error)

	// AgentConfig returns the agent config for the machine agent that is
	// running the deployer.
	AgentConfig() agent.Config
}

Context abstracts away the differences between different unit deployment strategies; where a Deployer is responsible for what to deploy, a Context is responsible for how to deploy.

type Deployer

type Deployer struct {
	// contains filtered or unexported fields
}

Deployer is responsible for deploying and recalling unit agents, according to changes in a set of state units; and for the final removal of its agents' units from state when they are no longer needed.

func (*Deployer) Handle

func (d *Deployer) Handle(_ <-chan struct{}, unitNames []string) error

func (*Deployer) SetUp

func (d *Deployer) SetUp() (watcher.StringsWatcher, error)

func (*Deployer) TearDown

func (d *Deployer) TearDown() error

type ManifoldConfig

type ManifoldConfig struct {
	AgentName        string
	APICallerName    string
	NewDeployContext func(st *apideployer.State, agentConfig agent.Config) Context
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type SimpleContext

type SimpleContext struct {
	// contains filtered or unexported fields
}

SimpleContext is a Context that manages unit deployments on the local system.

func NewSimpleContext

func NewSimpleContext(agentConfig agent.Config, api APICalls) *SimpleContext

NewSimpleContext returns a new SimpleContext, acting on behalf of the specified deployer, that deploys unit agents. Paths to which agents and tools are installed are relative to dataDir.

func (*SimpleContext) AgentConfig

func (ctx *SimpleContext) AgentConfig() agent.Config

func (*SimpleContext) DeployUnit

func (ctx *SimpleContext) DeployUnit(unitName, initialPassword string) (err error)

func (*SimpleContext) DeployedUnits

func (ctx *SimpleContext) DeployedUnits() ([]string, error)

func (*SimpleContext) RecallUnit

func (ctx *SimpleContext) RecallUnit(unitName string) error

Jump to

Keyboard shortcuts

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