Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ReadAgentConfig ¶
func ReadAgentConfig(c AgentConfigReader, agentId string) error
ReadAgentConfig is a helper to read either machine or controller agent config, whichever is there. Machine config gets precedence.
Types ¶
type AgentConf ¶
type AgentConf interface { // 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 an interface that provides access to the agent's configuration.
type AgentConfig ¶
type AgentConfig struct { RawDataDir string // contains filtered or unexported fields }
AgentConfig implements AgentConf, it is expected to be embedded in other types that need to implement AgentConf.
func NewAgentConfig ¶
func NewAgentConfig(dataDir string) *AgentConfig
NewAgentConfig returns a new AgentConfig.
func NewAgentConfigWithConfigSetterWriter ¶
func NewAgentConfigWithConfigSetterWriter(dataDir string, config agent.ConfigSetterWriter) *AgentConfig
NewAgentConfig returns a new AgentConfig.
func (*AgentConfig) ChangeConfig ¶
func (c *AgentConfig) ChangeConfig(change agent.ConfigMutator) error
ChangeConfig modifies this configuration using the given mutator.
func (*AgentConfig) CurrentConfig ¶
func (c *AgentConfig) CurrentConfig() agent.Config
CurrentConfig returns the agent config for this agent.
func (*AgentConfig) DataDir ¶
func (c *AgentConfig) DataDir() string
DataDir returns the directory where this agent should store its data.
func (*AgentConfig) ReadConfig ¶
func (c *AgentConfig) ReadConfig(tag string) error
ReadConfig reads the agent's config from its config file.
type AgentConfigReader ¶
type AgentConfigReader interface { // ReadConfig reads the config for the given tag from disk. ReadConfig(tag string) error }
AgentConfigWriter encapsulates disk I/O operations with the agent config.
type AgentConfigWriter ¶
type AgentConfigWriter interface { AgentConfigReader // 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.