server

package
v0.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 27 Imported by: 13

Documentation

Index

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

AgentInitializer is a function signature for a function that can register an agent

type AgentManager

type AgentManager interface {
	RegisterAgent(ctx context.Context, name string, agent agents.Agent, conn choria.AgentConnector) error
	Logger() *logrus.Entry
	Choria() *choria.Framework
}

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 independent copy of Choria

func NewInstance

func NewInstance(fw *choria.Framework) (i *Instance, err error)

NewInstance creates a new choria server instance

func (*Instance) AgentMetadata

func (srv *Instance) AgentMetadata(agent string) (agents.Metadata, bool)

AgentMetadata looks up the metadata for a specific agent

func (*Instance) BuildInfo added in v0.20.0

func (srv *Instance) BuildInfo() *build.Info

BuildInfo is the compile time settings for this process

func (*Instance) Choria

func (srv *Instance) Choria() *choria.Framework

Choria returns the choria framework

func (*Instance) Classes

func (srv *Instance) Classes() []string

Classes is a list of classification classes this node matches

func (*Instance) ConfigFile

func (srv *Instance) ConfigFile() string

ConfigFile determines the config file used to start the instance

func (*Instance) ConnectedServer

func (srv *Instance) ConnectedServer() string

ConnectedServer returns the URL of the broker this instance is connected to, "unknown" when not connected

func (*Instance) DataFuncMap added in v0.20.0

func (srv *Instance) DataFuncMap() (ddl.FuncMap, error)

DataFuncMap returns the list of known data plugins

func (*Instance) DenyAgent

func (srv *Instance) DenyAgent(agent string)

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) Identity

func (srv *Instance) Identity() string

Identity is the configured identity of the running server

func (*Instance) KnownAgents

func (srv *Instance) KnownAgents() []string

KnownAgents is a list of agents loaded into the server instance

func (*Instance) LastProcessedMessage

func (srv *Instance) LastProcessedMessage() time.Time

LastProcessedMessage is the time that the last message was processed in local time

func (*Instance) Logger

func (srv *Instance) Logger(component string) *log.Entry

Logger creates a new logger instance

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) MachinesStatusJSON added in v0.20.0

func (srv *Instance) MachinesStatusJSON() (json.RawMessage, error)

MachinesStatusJSON returns the status of all loaded autonomous agents

func (*Instance) NewEvent

func (srv *Instance) NewEvent(t lifecycle.Type, opts ...lifecycle.Option) error

NewEvent creates a new event with the server component and identity set and publishes it

func (*Instance) PrepareForShutdown added in v0.15.0

func (srv *Instance) PrepareForShutdown() error

PrepareForShutdown stops processing incoming requests without shutting down the whole server the network connection is closed and no new messages or replies are handled but the server keeps running, this will allow for shutdowns and restarts without duplicate handling of messages

func (*Instance) PrometheusTextFileDir added in v0.15.0

func (srv *Instance) PrometheusTextFileDir() string

PrometheusTextFileDir is the directory prometheus textfiles should be written to

func (*Instance) Provisioning

func (srv *Instance) Provisioning() bool

Provisioning determines if this is an instance running in provisioning mode

func (*Instance) PublishEvent

func (srv *Instance) PublishEvent(e lifecycle.Event) error

PublishEvent publishes a lifecycle event to the network

func (*Instance) PublishRaw

func (srv *Instance) PublishRaw(target string, data []byte) error

PublishRaw allows publishing to the connected middleware

func (*Instance) RegisterAgent

func (srv *Instance) RegisterAgent(ctx context.Context, name string, agent agents.Agent) error

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) Run

func (srv *Instance) Run(ctx context.Context, wg *sync.WaitGroup) error

func (*Instance) ScoutOverridesPath added in v0.15.0

func (srv *Instance) ScoutOverridesPath() string

ScoutOverridesPath is the path to a file defining node specific scout overrides

func (*Instance) ServerStatusFile added in v0.19.0

func (srv *Instance) ServerStatusFile() (string, int)

ServerStatusFile is the path where the server writes it's status file regularly and how frequently

func (*Instance) SetComponent

func (srv *Instance) SetComponent(c string)

SetComponent sets the component name this server will report in its lifecycle events. "server" and "provision_mode_server" are the defaults

func (*Instance) Shutdown added in v0.15.0

func (srv *Instance) Shutdown() error

Shutdown signals to the server that it should shutdown

func (*Instance) StartDataProviders added in v0.20.0

func (srv *Instance) StartDataProviders(ctx context.Context) (err error)

func (*Instance) StartMachine

func (srv *Instance) StartMachine(ctx context.Context, wg *sync.WaitGroup) (err error)

StartMachine starts the choria machine instances

func (*Instance) StartTime

func (srv *Instance) StartTime() time.Time

StartTime is the time this instance were created

func (*Instance) Stats

func (srv *Instance) Stats() statistics.ServerStats

Stats expose server statistics

func (*Instance) Status

func (srv *Instance) Status() *statistics.InstanceStatus

Status calculates the current server status

func (*Instance) UpTime

func (srv *Instance) UpTime() int64

UpTime returns how long the server has been running

func (*Instance) WriteServerStatus

func (srv *Instance) WriteServerStatus(ctx context.Context, wg *sync.WaitGroup)

WriteServerStatus periodically writes the server status to a file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL