Documentation
¶
Index ¶
- func RegisterAdditionalAgent(i AgentInitializer)
- func RegisterAdditionalAgentProvider(p AgentProvider)
- type AgentInitializer
- type AgentManager
- type AgentProvider
- type Instance
- func (srv *Instance) AgentMetadata(agent string) (agents.Metadata, bool)
- func (srv *Instance) Choria() *choria.Framework
- func (srv *Instance) Classes() []string
- func (srv *Instance) ConfigFile() string
- func (srv *Instance) ConnectedServer() string
- func (srv *Instance) DenyAgent(agent string)
- func (srv *Instance) Facts() json.RawMessage
- func (srv *Instance) Identity() string
- func (srv *Instance) KnownAgents() []string
- func (srv *Instance) LastProcessedMessage() time.Time
- func (srv *Instance) Logger(component string) *log.Entry
- func (srv *Instance) MachineTransition(name string, version string, path string, id string, transition string) error
- func (srv *Instance) MachinesStatus() ([]aagent.MachineState, error)
- func (srv *Instance) NewEvent(t lifecycle.Type, opts ...lifecycle.Option) error
- func (srv *Instance) Provisioning() bool
- func (srv *Instance) PublishEvent(e lifecycle.Event) error
- func (srv *Instance) PublishRaw(target string, data []byte) error
- func (srv *Instance) RegisterAgent(ctx context.Context, name string, agent agents.Agent) error
- func (srv *Instance) RegisterRegistrationProvider(ctx context.Context, wg *sync.WaitGroup, ...) error
- func (srv *Instance) Run(ctx context.Context, wg *sync.WaitGroup) error
- func (srv *Instance) SetComponent(c string)
- func (srv *Instance) StartMachine(ctx context.Context, wg *sync.WaitGroup) (err error)
- func (srv *Instance) StartTime() time.Time
- func (srv *Instance) Stats() agents.ServerStats
- func (srv *Instance) Status() *InstanceStatus
- func (srv *Instance) UpTime() int64
- func (srv *Instance) WriteServerStatus(ctx context.Context, wg *sync.WaitGroup)
- type InstanceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAdditionalAgent ¶
func RegisterAdditionalAgent(i AgentInitializer)
RegisterAdditionalAgent adds an agent to a running server this should be used for compile time injection of agents other than the ones that ship with choria
func RegisterAdditionalAgentProvider ¶
func RegisterAdditionalAgentProvider(p AgentProvider)
RegisterAdditionalAgentProvider registers an agent provider as a subsystem capable of delivering new types of agent like the legacy mcollective ruby compatible ones
Custom builders can use this to extend choria with new agent capabilities
Types ¶
type AgentInitializer ¶
type AgentInitializer func(context.Context, *agents.Manager, choria.InstanceConnector, *logrus.Entry) error
AgentInitializer is a function signature for a function that can register an agent
type AgentManager ¶
type AgentProvider ¶
type AgentProvider interface { Initialize(fw *choria.Framework, log *logrus.Entry) RegisterAgents(ctx context.Context, mgr AgentManager, connector choria.InstanceConnector, log *logrus.Entry) error Version() string }
AgentProvider is capable of adding agents into a running instance
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is an independant copy of Choria
func NewInstance ¶
NewInstance creates a new choria server instance
func (*Instance) AgentMetadata ¶
AgentMetadata looks up the metadata for a specific agent
func (*Instance) ConfigFile ¶
ConfigFile determines the config file used to start the instance
func (*Instance) ConnectedServer ¶
ConnectedServer returns the URL of the broker this instance is connected to, "unknown" when not connected
func (*Instance) DenyAgent ¶
DenyAgent prevents an agent from being loaded, if it was already loaded this has no effect
func (*Instance) Facts ¶
func (srv *Instance) Facts() json.RawMessage
Facts are all the known facts to this instance
func (*Instance) KnownAgents ¶
KnownAgents is a list of agents loaded into the server instance
func (*Instance) LastProcessedMessage ¶
LastProcessedMessage is the time that the last message was processed in local time
func (*Instance) MachineTransition ¶
func (srv *Instance) MachineTransition(name string, version string, path string, id string, transition string) error
MachineTransition sends a transition event to a specific running machine instance
func (*Instance) MachinesStatus ¶
func (srv *Instance) MachinesStatus() ([]aagent.MachineState, error)
MachinesStatus returns the status of all loaded autonomous agents
func (*Instance) NewEvent ¶
NewEvent creates a new event with the server component and identity set and publishes it
func (*Instance) Provisioning ¶
Provisioning determines if this is an instance running in provisioning mode
func (*Instance) PublishEvent ¶
PublishEvent publishes a lifecycle event to the network
func (*Instance) PublishRaw ¶
PublishRaw allows publishing to the connected middleware
func (*Instance) RegisterAgent ¶
RegisterAgent adds a new agent to the running instance
func (*Instance) RegisterRegistrationProvider ¶
func (srv *Instance) RegisterRegistrationProvider(ctx context.Context, wg *sync.WaitGroup, provider registration.RegistrationDataProvider) error
RegisterRegistrationProvider adds a new provider for registration data to the registration subsystem
func (*Instance) SetComponent ¶
SetComponent sets the component name this server will report in its lifecycle events. "server" and "provision_mode_server" are the defaults
func (*Instance) StartMachine ¶
StartMachine starts the choria machine instances
func (*Instance) Stats ¶
func (srv *Instance) Stats() agents.ServerStats
Stats expose server statistics
func (*Instance) Status ¶
func (srv *Instance) Status() *InstanceStatus
Status calculates the current server status
type InstanceStatus ¶
type InstanceStatus struct { Identity string `json:"identity"` Uptime int64 `json:"uptime"` ConnectedServer string `json:"connected_server"` LastMessage int64 `json:"last_message"` Provisioning bool `json:"provisioning_mode"` Stats *agents.ServerStats `json:"stats"` }
InstanceStatus describes the current instance status