Documentation ¶
Index ¶
- type Agent
- type AgentReply
- type Manager
- func (a *Manager) Choria() *choria.Framework
- func (a *Manager) DenyAgent(agent string)
- func (a *Manager) Dispatch(ctx context.Context, wg *sync.WaitGroup, replies chan *AgentReply, ...)
- func (a *Manager) Get(name string) (Agent, bool)
- func (a *Manager) KnownAgents() []string
- func (a *Manager) Logger() *logrus.Entry
- func (a *Manager) RegisterAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error
- type Metadata
- type ServerInfoSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent interface { Metadata() *Metadata Name() string HandleMessage(context.Context, *choria.Message, protocol.Request, choria.ConnectorInfo, chan *AgentReply) SetServerInfo(ServerInfoSource) ServerInfo() ServerInfoSource ShouldActivate() bool }
Agent is a generic choria agent
type AgentReply ¶
AgentReply is a generic reply from an agent
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages agents, handles registration, dispatches requests etc
func New ¶
func New(requests chan *choria.ConnectorMessage, fw *choria.Framework, conn choria.ConnectorInfo, srv ServerInfoSource, log *logrus.Entry) *Manager
New creates a new Agent Manager
func (*Manager) Dispatch ¶
func (a *Manager) Dispatch(ctx context.Context, wg *sync.WaitGroup, replies chan *AgentReply, msg *choria.Message, request protocol.Request)
Dispatch sends a request to a agent and wait for a reply
func (*Manager) KnownAgents ¶
KnownAgents retrieves a list of known agents
func (*Manager) RegisterAgent ¶
func (a *Manager) RegisterAgent(ctx context.Context, name string, agent Agent, conn choria.AgentConnector) error
RegisterAgent connects a new agent to the server instance, subscribe to all its targets etc
type Metadata ¶
type Metadata struct { License string `json:"license"` Author string `json:"author"` Timeout int `json:"timeout"` Name string `json:"name"` Version string `json:"version"` URL string `json:"url"` Description string `json:"description"` Provider string `json:"provider,omitempty"` }
Metadata describes an agent at a high level and is required for any agent
type ServerInfoSource ¶
type ServerInfoSource interface { AgentMetadata(string) (Metadata, bool) BuildInfo() *build.Info Classes() []string ConfigFile() string ConnectedServer() string DataFuncMap() (ddl.FuncMap, error) Facts() json.RawMessage Identity() string KnownAgents() []string LastProcessedMessage() time.Time MachineTransition(name string, version string, path string, id string, transition string) error MachinesStatus() ([]aagent.MachineState, error) NewEvent(t lifecycle.Type, opts ...lifecycle.Option) error PrepareForShutdown() error Provisioning() bool StartTime() time.Time Stats() statistics.ServerStats UpTime() int64 }
ServerInfoSource provides data about a running server instance
Click to show internal directories.
Click to hide internal directories.