Documentation
¶
Overview ¶
Package protocol provides the Go domain types used by the scheduler and other internal services to represent Golem nodes, tasks, and their lifecycle These types mirror the protobuf definitions in pkg/proto/golem/ but are pure Go structs - free of protobuf dependencies - so internal packages can use them without pulling in the generated code. Conversion helpers between proto - domain types are provided in covert.go
Index ¶
- func NodeInfoToProto(n *NodeInfo) *pb.NodeInfo
- func NodeLoadInfoToProto(n *NodeLoadInfo) *pb.NodeLoadInfo
- func TaskToProto(t *Task) *pb.Task
- type Capability
- type NodeInfo
- type NodeLoadInfo
- type NodeStatus
- type SystemInfo
- type Task
- type TaskPriority
- type TaskProgress
- type TaskResult
- type TaskStatusValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NodeInfoToProto ¶
NodeInfoToProto converts a domain NodeInfo to the protobuf type.
func NodeLoadInfoToProto ¶
func NodeLoadInfoToProto(n *NodeLoadInfo) *pb.NodeLoadInfo
NodeLoadInfoToProto converts a domain NodeLoadInfo to the protobuf type.
func TaskToProto ¶
TaskToProto converts a domain Task to the protobuf type.
Types ¶
type Capability ¶
Capability describes a single capability advertised by a Golem node.
type NodeInfo ¶
type NodeInfo struct {
ID string
Name string
Address string
Status string // "online", "offline", "draining", "cordoned"
SystemInfo SystemInfo
Capabilities []Capability
Labels map[string]string
Version string
RegisteredAt time.Time
LastSeenAt time.Time
}
NodeInfo is the static registration data for a Golem node.
func NodeInfoFromProto ¶
NodeInfoFromProto converts a protobuf NodeInfo to the domain type.
type NodeLoadInfo ¶
type NodeLoadInfo struct {
CPUPercent float64
MemoryPercent float64
DiskFreeMB int64
ActiveTasks int
QueuedTasks int
}
NodeLoadInfo is the dynamic load snapshot sent with each heartbeat.
func NodeLoadInfoFromProto ¶
func NodeLoadInfoFromProto(p *pb.NodeLoadInfo) NodeLoadInfo
NodeLoadInfoFromProto converts a protobuf NodeLoadInfo to the domain type.
type NodeStatus ¶
type NodeStatus string
NodeStatus represents the operational state of a Golem node.
const ( NodeStatusOnline NodeStatus = "online" NodeStatusOffline NodeStatus = "offline" NodeStatusDraining NodeStatus = "draining" NodeStatusCordoned NodeStatus = "cordoned" )
type SystemInfo ¶
type SystemInfo struct {
CPUCores int
MemoryMB int
DiskFreeMB int
OS string
Arch string
Hostname string
}
SystemInfo contains static hardware / OS information reported once at registration.
type Task ¶
type Task struct {
ID string
Name string
SkillName string
Payload []byte // JSON-encoded skill parameters
Status TaskStatusValue
Priority TaskPriority
AssignedNodeID string
SessionID string
AgentID string
Result []byte // JSON-encoded result
Error string
Timeout time.Duration
CreatedAt time.Time
StartedAt *time.Time
CompletedAt *time.Time
Metadata map[string]string
}
Task is the central work unit dispatched to Golem nodes.
func TaskFromProto ¶
TaskFromProto converts a protobuf Task to the domain type.
type TaskPriority ¶
type TaskPriority int
TaskPriority controls scheduling order (higher value = higher priority).
const ( TaskPriorityLow TaskPriority = 1 TaskPriorityNormal TaskPriority = 5 TaskPriorityHigh TaskPriority = 8 TaskPriorityCritical TaskPriority = 10 )
type TaskProgress ¶
type TaskProgress struct {
TaskID string
ProgressPercent float64
StatusMessage string
PartialResult []byte
}
TaskProgress carries incremental progress from a running task.
func TaskProgressFromProto ¶
func TaskProgressFromProto(p *pb.TaskProgress) *TaskProgress
TaskProgressFromProto converts a protobuf TaskProgress to the domain type.
type TaskResult ¶
TaskResult carries the final outcome of a completed task.
func TaskResultFromProto ¶
func TaskResultFromProto(p *pb.TaskResult) *TaskResult
TaskResultFromProto converts a protobuf TaskResult to the domain type.
type TaskStatusValue ¶
type TaskStatusValue string
TaskStatus represents the lifecycle state of a task.
const ( TaskStatusPending TaskStatusValue = "pending" TaskStatusAssigned TaskStatusValue = "assigned" TaskStatusRunning TaskStatusValue = "running" TaskStatusCompleted TaskStatusValue = "completed" TaskStatusFailed TaskStatusValue = "failed" TaskStatusCancelled TaskStatusValue = "cancelled" TaskStatusTimedOut TaskStatusValue = "timed_out" )