Documentation ¶
Index ¶
- Constants
- func SaveLog(wsConn ws.Connector, agentId uint, tickChan <-chan time.Time, ...) error
- type ByTs
- type DbHandler
- type LocalAgent
- type LocalDirectory
- type LogFilter
- type LogHandler
- type MySQLHandler
- func (h *MySQLHandler) Create(agent proto.Agent) (string, error)
- func (h *MySQLHandler) Get(uuid string) (uint, *proto.Agent, error)
- func (h *MySQLHandler) GetAll() ([]proto.Agent, error)
- func (h *MySQLHandler) GetConfigs(agentId uint) ([]proto.AgentConfig, error)
- func (h *MySQLHandler) RemoveConfig(agentId uint, service, otherUUID string) error
- func (h *MySQLHandler) SetConfig(agentId uint, service, otherUUID string, set, running []byte) error
- func (h *MySQLHandler) Update(agentId uint, agent proto.Agent) error
- func (h *MySQLHandler) UpdateConfigs(agentId uint, configs []proto.AgentConfig, reset bool) error
- func (h *MySQLHandler) UpdateVersion(agentId uint, version proto.Version) error
- type Processor
Constants ¶
const ( MIN_LOG_LEVEL = proto.LOG_ERROR MAX_LOG_LEVEL = proto.LOG_DEBUG )
const LOG_BUF_SIZE = 10
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DbHandler ¶
type DbHandler interface { Create(agent proto.Agent) (string, error) Get(uuid string) (uint, *proto.Agent, error) GetAll() ([]proto.Agent, error) SetConfig(agentId uint, service, otheUUID string, set, running []byte) error RemoveConfig(agentId uint, service, otherUUID string) error Update(agentId uint, agent proto.Agent) error UpdateConfigs(agentId uint, configs []proto.AgentConfig, reset bool) error UpdateVersion(agentId uint, version proto.Version) error }
type LocalAgent ¶
type LocalAgent struct {
// contains filtered or unexported fields
}
A LocalAgent is a Communicator for an agent connected to this API. It uses a ws.Multiplexer to serialize commands to and replies from the agent. The comm processor updates oN tables as necessary. This allows processes (controllers, services, etc.) in this API to communicate with this agent. A LocalAgent should only be created in the agent comm websocket controller, which registers it with the LocalDirectory.
func NewLocalAgent ¶
func NewLocalAgent(agentId uint, mx ws.Multiplexer) *LocalAgent
func (*LocalAgent) Done ¶
func (a *LocalAgent) Done() chan bool
func (*LocalAgent) IsAlive ¶
func (a *LocalAgent) IsAlive() bool
func (*LocalAgent) Start ¶
func (a *LocalAgent) Start() error
func (*LocalAgent) Stop ¶
func (a *LocalAgent) Stop()
type LocalDirectory ¶
type LocalDirectory struct {
// contains filtered or unexported fields
}
func NewLocalDirectory ¶
func NewLocalDirectory() *LocalDirectory
func (*LocalDirectory) Add ¶
func (d *LocalDirectory) Add(agentId uint, comm shared.AgentCommunicator) error
Used by agent comm controller to register local agent
func (*LocalDirectory) Get ¶
func (d *LocalDirectory) Get(agentId uint) shared.AgentCommunicator
func (*LocalDirectory) Refresh ¶
func (d *LocalDirectory) Refresh(timeLimit time.Duration)
func (*LocalDirectory) Remove ¶
func (d *LocalDirectory) Remove(agentId uint)
Used by agent comm controller to unregister local agent.
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
func NewLogHandler ¶
func NewLogHandler(dbm db.Manager, stats *stats.Stats) *LogHandler
type MySQLHandler ¶
type MySQLHandler struct {
// contains filtered or unexported fields
}
func NewMySQLHandler ¶
func NewMySQLHandler(dbm db.Manager, ih instance.DbHandler) *MySQLHandler
func (*MySQLHandler) GetConfigs ¶
func (h *MySQLHandler) GetConfigs(agentId uint) ([]proto.AgentConfig, error)
func (*MySQLHandler) RemoveConfig ¶
func (h *MySQLHandler) RemoveConfig(agentId uint, service, otherUUID string) error
func (*MySQLHandler) SetConfig ¶
func (h *MySQLHandler) SetConfig(agentId uint, service, otherUUID string, set, running []byte) error
func (*MySQLHandler) UpdateConfigs ¶
func (h *MySQLHandler) UpdateConfigs(agentId uint, configs []proto.AgentConfig, reset bool) error
func (*MySQLHandler) UpdateVersion ¶
func (h *MySQLHandler) UpdateVersion(agentId uint, version proto.Version) error
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
A Processor updates oN tables for certain commands and replies. It is per-agent and NOT concurrent[1], so cmds is not guarded with a mutex, because cmds to agent must be serialized (including cmd=Status; agent parallelizes these internally).
[1] Be sure ws.NewConcurrentMultiplexer(..., concurrency=0) in NewLocalAgent()!
Else the multiplexer will call AfterRecv() concurrently.