Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDeployer ¶
func NewDeployer(st *apideployer.State, ctx Context) worker.Worker
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.
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