api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToPBAgentMessage

func ToPBAgentMessage(msg *AgentMessage) *transportpb.AgentMessage

func ToPBCommand

func ToPBCommand(v *Command) *transportpb.Command

func ToPBCommandResult

func ToPBCommandResult(v *CommandResult) *transportpb.CommandResult

func ToPBMetricSample

func ToPBMetricSample(v MetricSample) *transportpb.MetricSample

func ToPBRegistration

func ToPBRegistration(v *Registration) *transportpb.Registration

func ToPBServerMessage

func ToPBServerMessage(msg *ServerMessage) *transportpb.ServerMessage

Types

type AgentMessage

type AgentMessage struct {
	Kind         MessageKind
	Registration *Registration
	Metrics      *MetricsBatch
	Result       *CommandResult
	Heartbeat    *Heartbeat
}

func FromPBAgentMessage

func FromPBAgentMessage(msg *transportpb.AgentMessage) *AgentMessage

type BasicInfo

type BasicInfo struct {
	Hostname       string
	IPs            []string
	OS             string
	Kernel         string
	Arch           string
	MachineID      string
	BootID         string
	HardwareModel  string
	HardwareVendor string
}

type Command

type Command struct {
	ID       string
	NodeID   string
	Type     CommandType
	IssuedAt int64
	Payload  any
}

func FromPBCommand

func FromPBCommand(v *transportpb.Command) *Command

type CommandResult

type CommandResult struct {
	CommandID  string
	NodeID     string
	Type       CommandType
	Success    bool
	Error      string
	FinishedAt int64
}

func FromPBCommandResult

func FromPBCommandResult(v *transportpb.CommandResult) *CommandResult

type CommandType

type CommandType string

type Heartbeat

type Heartbeat struct {
	NodeID string
	At     int64
}

func NewHeartbeat

func NewHeartbeat(nodeID string) *Heartbeat

type MessageKind

type MessageKind string
const (
	MessageKindRegister      MessageKind = "register"
	MessageKindMetrics       MessageKind = "metrics"
	MessageKindCommandResult MessageKind = "command_result"
	MessageKindHeartbeat     MessageKind = "heartbeat"
	MessageKindCommand       MessageKind = "command"
	MessageKindAck           MessageKind = "ack"
)

type MetricCategory

type MetricCategory string

type MetricSample

type MetricSample struct {
	Category MetricCategory
	At       int64
	Payload  any
}

func FromPBMetricSample

func FromPBMetricSample(v *transportpb.MetricSample) MetricSample

type MetricsBatch

type MetricsBatch struct {
	NodeID  string
	Samples []MetricSample
	SentAt  int64
}

type NodeSnapshot

type NodeSnapshot struct {
	NodeID       string
	Connected    bool
	LastSeen     int64
	SourceIP     string
	Registration *Registration
	Latest       map[string]TimedSample
}

type Registration

type Registration struct {
	NodeID  string
	Basic   BasicInfo
	Modules map[string]any
	At      int64
}

func FromPBRegistration

func FromPBRegistration(v *transportpb.Registration) *Registration

type ServerAck

type ServerAck struct {
	NodeID string
	At     int64
}

type ServerMessage

type ServerMessage struct {
	Kind    MessageKind
	Command *Command
	Ack     *ServerAck
}

func FromPBServerMessage

func FromPBServerMessage(msg *transportpb.ServerMessage) *ServerMessage

type TimedSample

type TimedSample struct {
	NodeID   string
	Category MetricCategory
	At       int64
	Payload  any
}

Jump to

Keyboard shortcuts

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