grpc

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuthStreamInterceptor

func AdminAuthStreamInterceptor(tm tokenmanager.TokenManager) grpc.StreamServerInterceptor

AdminAuthStreamInterceptor returns a gRPC StreamServerInterceptor that validates the Admin Token for HivemindAdminService streaming methods.

func AdminAuthUnaryInterceptor

func AdminAuthUnaryInterceptor(tm tokenmanager.TokenManager) grpc.UnaryServerInterceptor

AdminAuthUnaryInterceptor returns a gRPC UnaryServerInterceptor that validates the Admin Token for HivemindAdminService methods. Non-admin methods (e.g. GolemNodeService) pass through without authentication.

Types

type AdminServiceHandler

type AdminServiceHandler struct {
	pb.UnimplementedHivemindAdminServiceServer
	// contains filtered or unexported fields
}

AdminServiceHandler implements pb.HivemindAdminServiceServer. It provides administrative operations on Golem nodes and Bootstrap Tokens.

func NewAdminServiceHandler

func NewAdminServiceHandler(reg registry.Registry, tm tokenmanager.TokenManager) *AdminServiceHandler

NewAdminServiceHandler creates a new AdminServiceHandler.

func (*AdminServiceHandler) CordonNode

CordonNode marks a Golem node as unschedulable.

func (*AdminServiceHandler) CreateToken

CreateToken creates a new Bootstrap Token.

func (*AdminServiceHandler) DeleteToken

DeleteToken deletes a Bootstrap Token.

func (*AdminServiceHandler) GetNode

GetNode returns details of a single Golem node.

func (*AdminServiceHandler) ListNodes

ListNodes returns a list of registered Golem nodes.

func (*AdminServiceHandler) ListTokens

ListTokens lists all Bootstrap Tokens.

func (*AdminServiceHandler) UncordonNode

UncordonNode marks a Golem node as schedulable.

type NodeServiceHandler

type NodeServiceHandler struct {
	pb.UnimplementedGolemNodeServiceServer
	// contains filtered or unexported fields
}

NodeServiceHandler implements pb.GolemNodeServiceServer and dispatcher.StreamManager. It manages per-node heartbeat streams for both heartbeat and task dispatch.

func NewNodeServiceHandler

func NewNodeServiceHandler(reg registry.Registry, tm tokenmanager.TokenManager, devMode bool) *NodeServiceHandler

NewNodeServiceHandler creates a new NodeServiceHandler.

func (*NodeServiceHandler) Deregister

Deregister handles a Golem node deregistration request.

func (*NodeServiceHandler) Heartbeat

Heartbeat handles the bidirectional heartbeat stream. It also acts as the channel for dispatching tasks to the Golem node.

func (*NodeServiceHandler) Register

Register handles a Golem node registration request. A valid join-token (bootstrap token) is REQUIRED for registration unless dev-mode is enabled AND the client connects from a loopback address. If the node is already registered (re-registration after reconnect), token validation is skipped to avoid consuming extra token usages.

func (*NodeServiceHandler) ReportTaskProgress

ReportTaskProgress handles a task progress update from Golem.

func (*NodeServiceHandler) ReportTaskResult

ReportTaskResult handles a task result report from Golem. It delivers the result to the waiting WaitForResult channel if one exists.

func (*NodeServiceHandler) SendToNode

func (h *NodeServiceHandler) SendToNode(nodeID string, resp *pb.HeartbeatResponse) error

SendToNode sends a HeartbeatResponse to the specified node's heartbeat stream. This implements dispatcher.StreamManager.

func (*NodeServiceHandler) WaitForResult

func (h *NodeServiceHandler) WaitForResult(ctx context.Context, nodeID string, taskID string) (*pb.DispatchTaskResponse, error)

WaitForResult blocks until the task execution result is reported by the Golem node via ReportTaskResult RPC, or the context is cancelled/timed out. This implements dispatcher.StreamManager.

Jump to

Keyboard shortcuts

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