registry

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package registry provides functionality for managing and tracking FODC agents.

Index

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

func (ar *AgentRegistry) Stop()

Stop stops the health check goroutine.

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

Jump to

Keyboard shortcuts

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