Documentation
¶
Index ¶
- type CompletedConfig
- type Config
- type Service
- func (s *Service) DecrActiveTasks()
- func (s *Service) IncrActiveTasks()
- func (s *Service) NodeID() string
- func (s *Service) ReportTaskProgress(ctx context.Context, progress *pb.TaskProgress) error
- func (s *Service) ReportTaskResult(ctx context.Context, result *pb.TaskResult) error
- func (s *Service) SetStatus(status pb.NodeStatus)
- func (s *Service) SetTaskHandler(handler TaskHandler)
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Status() pb.NodeStatus
- func (s *Service) Stop(ctx context.Context) error
- type TaskHandler
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 ¶
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) ReportTaskProgress ¶
ReportTaskProgress sends a task progress update to Hivemind.
func (*Service) ReportTaskResult ¶
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 ¶
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.
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.