Documentation
¶
Overview ¶
Package registry provides functionality for managing and tracking FODC agents.
Index ¶
- type AgentIdentity
- type AgentInfo
- type AgentRegistry
- func (ar *AgentRegistry) CheckAgentHealth() error
- func (ar *AgentRegistry) GetAgent(podName string, role string, labels map[string]string) (*AgentInfo, error)
- func (ar *AgentRegistry) GetAgentByID(agentID string) (*AgentInfo, error)
- func (ar *AgentRegistry) ListAgents() []*AgentInfo
- func (ar *AgentRegistry) ListAgentsByRole(role string) []*AgentInfo
- func (ar *AgentRegistry) RegisterAgent(_ context.Context, identity AgentIdentity) (string, error)
- func (ar *AgentRegistry) Stop()
- func (ar *AgentRegistry) UnregisterAgent(agentID string) error
- func (ar *AgentRegistry) UpdateHeartbeat(agentID string) error
- type AgentStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentIdentity ¶
type AgentIdentity struct {
Labels map[string]string
Role string
PodName string
ContainerNames []string
}
AgentIdentity represents the identity of an agent.
type AgentInfo ¶
type AgentInfo struct {
Labels map[string]string
AgentID string
Status AgentStatus
RegisteredAt time.Time
LastHeartbeat time.Time
AgentIdentity AgentIdentity
}
AgentInfo contains information about a registered agent.
type AgentRegistry ¶
type AgentRegistry struct {
// contains filtered or unexported fields
}
AgentRegistry manages the lifecycle and state of all connected FODC Agents.
func NewAgentRegistry ¶
func NewAgentRegistry(logger *logger.Logger, heartbeatTimeout, cleanupTimeout time.Duration, maxAgents int) *AgentRegistry
NewAgentRegistry creates a new AgentRegistry instance.
func (*AgentRegistry) CheckAgentHealth ¶
func (ar *AgentRegistry) CheckAgentHealth() error
CheckAgentHealth periodically checks agent health based on heartbeat timeout.
func (*AgentRegistry) GetAgent ¶
func (ar *AgentRegistry) GetAgent(podName string, role string, labels map[string]string) (*AgentInfo, error)
GetAgent retrieves agent information by primary containerNames + role + labels.
func (*AgentRegistry) GetAgentByID ¶
func (ar *AgentRegistry) GetAgentByID(agentID string) (*AgentInfo, error)
GetAgentByID retrieves agent information by unique agent ID.
func (*AgentRegistry) ListAgents ¶
func (ar *AgentRegistry) ListAgents() []*AgentInfo
ListAgents returns a list of all registered agents.
func (*AgentRegistry) ListAgentsByRole ¶
func (ar *AgentRegistry) ListAgentsByRole(role string) []*AgentInfo
ListAgentsByRole returns agents filtered by role.
func (*AgentRegistry) RegisterAgent ¶
func (ar *AgentRegistry) RegisterAgent(_ context.Context, identity AgentIdentity) (string, error)
RegisterAgent registers a new agent or updates existing agent information.
func (*AgentRegistry) UnregisterAgent ¶
func (ar *AgentRegistry) UnregisterAgent(agentID string) error
UnregisterAgent removes an agent from the registry.
func (*AgentRegistry) UpdateHeartbeat ¶
func (ar *AgentRegistry) UpdateHeartbeat(agentID string) error
UpdateHeartbeat updates the last heartbeat timestamp for an agent.
type AgentStatus ¶
type AgentStatus string
AgentStatus represents the current status of an agent.
const ( // AgentStatusOnline indicates the agent is online and connected. AgentStatusOnline AgentStatus = "online" // AgentStatusOffline indicates the agent is offline or unconnected. AgentStatusOffline AgentStatus = "unconnected" )