node

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletedConfig

type CompletedConfig struct {
	*Config
}

CompletedConfig is the result of calling Complete on Config.

func (*CompletedConfig) New

func (c *CompletedConfig) New() (*Service, error)

New creates a new node Service instance.

type Config

type Config struct {
	NodeName           string
	NodeLabels         map[string]string
	HivemindAddress    string // Hivemind gRPC address to connect to
	HeartbeatInterval  time.Duration
	ConnectTimeout     time.Duration
	ReconnectInterval  time.Duration
	MaxConcurrentTasks int32
	WorkspaceDir       string
	SkillsDir          string
	JoinToken          string // Bootstrap Token for registration; empty = no auth (local dev)
}

Config holds configuration for the Golem node service

func (*Config) Complete

func (c *Config) Complete() *CompletedConfig

Complete fills in default values for any unset fields.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages the Golem node lifecycle: registration, heartbeat, and task reporting.

func NewService

func NewService(cfg *Config) (*Service, error)

NewService creates a new node Service from the given config.

func (*Service) DecrActiveTasks

func (s *Service) DecrActiveTasks()

DecrActiveTasks decrements the active task count.

func (*Service) IncrActiveTasks

func (s *Service) IncrActiveTasks()

IncrActiveTasks increments the active task count.

func (*Service) NodeID

func (s *Service) NodeID() string

NodeID returns the unique identifier of this Golem node.

func (*Service) ReportTaskProgress

func (s *Service) ReportTaskProgress(ctx context.Context, progress *pb.TaskProgress) error

ReportTaskProgress sends a task progress update to Hivemind.

func (*Service) ReportTaskResult

func (s *Service) ReportTaskResult(ctx context.Context, result *pb.TaskResult) error

ReportTaskResult sends a task result to Hivemind.

func (*Service) SetStatus

func (s *Service) SetStatus(status pb.NodeStatus)

SetStatus updates the node status.

func (*Service) SetTaskHandler

func (s *Service) SetTaskHandler(handler TaskHandler)

SetTaskHandler registers the handler for tasks dispatched via heartbeat stream.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start connects to Hivemind, registers the node, and starts the heartbeat loop. Registration is handled by the heartbeat loop itself, which re-registers. before each heartbeat stream to handle Hivemind restarts gracefully.

func (*Service) Status

func (s *Service) Status() pb.NodeStatus

Status returns the current node status.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop deregisters the node from Hivemind and closes the gRPC connection.

type TaskHandler

type TaskHandler interface {
	// HandleTask executes a dispatched task asynchronously.
	HandleTask(ctx context.Context, task *pb.Task)
	// CancelTask cancels a running task.
	CancelTask(taskID string, reason string)
}

TaskHandler handles tasks dispatched from Hivemind via the heartbeat stream.

Jump to

Keyboard shortcuts

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