Documentation
¶
Overview ¶
agent contains jujud's machine agent.
Index ¶
- Variables
- func DefaultIntrospectionSocketName(entityTag names.Tag) string
- func MachineAgentFactoryFn(agentConfWriter AgentConfigWriter, bufferedLogger *logsender.BufferedLogWriter, ...) func(string) (*MachineAgent, error)
- func NewMachineAgentCmd(ctx *cmd.Context, machineAgentFactory func(string) (*MachineAgent, error), ...) cmd.Command
- func NewModelStorageDataSource(stor storage.Storage, priority int, requireSigned bool) simplestreams.DataSource
- type AgentConf
- type AgentConfigWriter
- type AgentInitializer
- type MachineAgent
- func (a *MachineAgent) BeginRestore() error
- func (a *MachineAgent) ChangeConfig(mutate agent.ConfigMutator) error
- func (a *MachineAgent) EndRestore()
- func (a *MachineAgent) IsRestorePreparing() bool
- func (a *MachineAgent) IsRestoreRunning() bool
- func (a *MachineAgent) PrepareRestore() error
- func (a *MachineAgent) Restart() error
- func (a *MachineAgent) Run(*cmd.Context) error
- func (a *MachineAgent) Stop() error
- func (a *MachineAgent) Tag() names.Tag
- func (a *MachineAgent) Wait() error
- func (a *MachineAgent) WorkersStarted() <-chan struct{}
- type MongoSessioner
- type UnitAgent
- func (a *UnitAgent) APIWorkers() (worker.Worker, error)
- func (a *UnitAgent) ChangeConfig(mutate agent.ConfigMutator) error
- func (a *UnitAgent) Info() *cmd.Info
- func (a *UnitAgent) Init(args []string) error
- func (a *UnitAgent) Run(ctx *cmd.Context) error
- func (a *UnitAgent) SetFlags(f *gnuflag.FlagSet)
- func (a *UnitAgent) Stop() error
- func (a *UnitAgent) Tag() names.Tag
Constants ¶
This section is empty.
Variables ¶
var ProductionMongoWriteConcern = true
Variable to override in tests, default is true
Functions ¶
func DefaultIntrospectionSocketName ¶
DefaultIntrospectionSocketName returns the socket name to use for the abstract domain socket that the introspection worker serves requests over.
func MachineAgentFactoryFn ¶
func MachineAgentFactoryFn( agentConfWriter AgentConfigWriter, bufferedLogger *logsender.BufferedLogWriter, newIntrospectionSocketName func(names.Tag) string, preUpgradeSteps upgrades.PreUpgradeStepsFunc, rootDir string, ) func(string) (*MachineAgent, error)
MachineAgentFactoryFn returns a function which instantiates a MachineAgent given a machineId.
func NewMachineAgentCmd ¶
func NewMachineAgentCmd( ctx *cmd.Context, machineAgentFactory func(string) (*MachineAgent, error), agentInitializer AgentInitializer, configFetcher AgentConfigWriter, ) cmd.Command
NewMachineAgentCmd creates a Command which handles parsing command-line arguments and instantiating and running a MachineAgent.
func NewModelStorageDataSource ¶
func NewModelStorageDataSource(stor storage.Storage, priority int, requireSigned bool) simplestreams.DataSource
NewModelStorageDataSource returns a new datasource that retrieves metadata from environment storage.
Types ¶
type AgentConf ¶
type AgentConf interface { // AddFlags injects common agent flags into f. AddFlags(f *gnuflag.FlagSet) // CheckArgs reports whether the given args are valid for this agent. CheckArgs(args []string) error // DataDir returns the directory where this agent should store its data. DataDir() string // ReadConfig reads the agent's config from its config file. ReadConfig(tag string) error // CurrentConfig returns the agent config for this agent. CurrentConfig() agent.Config // ChangeConfig modifies this configuration using the given mutator. ChangeConfig(change agent.ConfigMutator) error }
AgentConf is a terribly confused interface.
Parts of it are a mixin for cmd.Command implementations; others are a mixin for agent.Agent implementations; others bridge the two. We should be aiming to separate the cmd responsibilities from the agent responsibilities.
func NewAgentConf ¶
NewAgentConf returns a new value that satisfies AgentConf
type AgentConfigWriter ¶
type AgentConfigWriter interface { // ReadConfig reads the config for the given tag from disk. ReadConfig(tag string) error // ChangeConfig executes the given agent.ConfigMutator in a // thread-safe context. ChangeConfig(agent.ConfigMutator) error // CurrentConfig returns a copy of the in-memory agent config. CurrentConfig() agent.Config }
AgentConfigWriter encapsulates disk I/O operations with the agent config.
type AgentInitializer ¶
AgentInitializer handles initializing a type for use as a Jujud agent.
type MachineAgent ¶
type MachineAgent struct { AgentConfigWriter // contains filtered or unexported fields }
MachineAgent is responsible for tying together all functionality needed to orchestrate a Jujud instance which controls a machine.
func NewMachineAgent ¶
func NewMachineAgent( machineId string, agentConfWriter AgentConfigWriter, bufferedLogger *logsender.BufferedLogWriter, runner *worker.Runner, loopDeviceManager looputil.LoopDeviceManager, newIntrospectionSocketName func(names.Tag) string, preUpgradeSteps upgrades.PreUpgradeStepsFunc, rootDir string, ) (*MachineAgent, error)
NewMachineAgent instantiates a new MachineAgent.
func (*MachineAgent) BeginRestore ¶
func (a *MachineAgent) BeginRestore() error
BeginRestore will flag the agent to disallow all commands since restore should be running and therefore making changes that would override anything done.
func (*MachineAgent) ChangeConfig ¶
func (a *MachineAgent) ChangeConfig(mutate agent.ConfigMutator) error
func (*MachineAgent) EndRestore ¶
func (a *MachineAgent) EndRestore()
EndRestore will flag the agent to allow all commands This being invoked means that restore process failed since success restarts the agent.
func (*MachineAgent) IsRestorePreparing ¶
func (a *MachineAgent) IsRestorePreparing() bool
IsRestorePreparing returns bool representing if we are in restore mode but not running restore.
func (*MachineAgent) IsRestoreRunning ¶
func (a *MachineAgent) IsRestoreRunning() bool
IsRestoreRunning returns bool representing if we are in restore mode and running the actual restore process.
func (*MachineAgent) PrepareRestore ¶
func (a *MachineAgent) PrepareRestore() error
PrepareRestore will flag the agent to allow only a limited set of commands defined in "github.com/juju/juju/apiserver".allowedMethodsAboutToRestore the most noteworthy is: Backups.Restore: this will ensure that we can do all the file movements required for restore and no one will do changes while we do that. it will return error if the machine is already in this state.
func (*MachineAgent) Restart ¶
func (a *MachineAgent) Restart() error
Restart restarts the agent's service.
func (*MachineAgent) Tag ¶
func (a *MachineAgent) Tag() names.Tag
func (*MachineAgent) Wait ¶
func (a *MachineAgent) Wait() error
Wait waits for the machine agent to finish.
func (*MachineAgent) WorkersStarted ¶
func (a *MachineAgent) WorkersStarted() <-chan struct{}
WorkersStarted returns a channel that's closed once all top level workers have been started. This is provided for testing purposes.
type MongoSessioner ¶
type MongoSessioner interface {
MongoSession() *mgo.Session
}
type UnitAgent ¶
type UnitAgent struct { cmd.CommandBase AgentConf UnitName string // contains filtered or unexported fields }
UnitAgent is a cmd.Command responsible for running a unit agent.
func NewUnitAgent ¶
func NewUnitAgent(ctx *cmd.Context, bufferedLogger *logsender.BufferedLogWriter) (*UnitAgent, error)
NewUnitAgent creates a new UnitAgent value properly initialized.
func (*UnitAgent) APIWorkers ¶
APIWorkers returns a dependency.Engine running the unit agent's responsibilities.
func (*UnitAgent) ChangeConfig ¶
func (a *UnitAgent) ChangeConfig(mutate agent.ConfigMutator) error