Documentation
¶
Index ¶
- func AdminAuthStreamInterceptor(tm tokenmanager.TokenManager) grpc.StreamServerInterceptor
- func AdminAuthUnaryInterceptor(tm tokenmanager.TokenManager) grpc.UnaryServerInterceptor
- type AdminServiceHandler
- func (h *AdminServiceHandler) CordonNode(ctx context.Context, req *pb.CordonNodeRequest) (*pb.CordonNodeResponse, error)
- func (h *AdminServiceHandler) CreateToken(ctx context.Context, req *pb.CreateTokenRequest) (*pb.CreateTokenResponse, error)
- func (h *AdminServiceHandler) DeleteToken(ctx context.Context, req *pb.DeleteTokenRequest) (*pb.DeleteTokenResponse, error)
- func (h *AdminServiceHandler) GetNode(ctx context.Context, req *pb.GetNodeRequest) (*pb.GetNodeResponse, error)
- func (h *AdminServiceHandler) ListNodes(ctx context.Context, req *pb.ListNodesRequest) (*pb.ListNodesResponse, error)
- func (h *AdminServiceHandler) ListTokens(ctx context.Context, req *pb.ListTokensRequest) (*pb.ListTokensResponse, error)
- func (h *AdminServiceHandler) UncordonNode(ctx context.Context, req *pb.UncordonNodeRequest) (*pb.UncordonNodeResponse, error)
- type NodeServiceHandler
- func (h *NodeServiceHandler) Deregister(ctx context.Context, req *pb.DeregisterRequest) (*pb.DeregisterResponse, error)
- func (h *NodeServiceHandler) Heartbeat(stream pb.GolemNodeService_HeartbeatServer) error
- func (h *NodeServiceHandler) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.RegisterResponse, error)
- func (h *NodeServiceHandler) ReportTaskProgress(ctx context.Context, req *pb.ReportTaskProgressRequest) (*pb.ReportTaskProgressResponse, error)
- func (h *NodeServiceHandler) ReportTaskResult(ctx context.Context, req *pb.ReportTaskResultRequest) (*pb.ReportTaskResultResponse, error)
- func (h *NodeServiceHandler) SendToNode(nodeID string, resp *pb.HeartbeatResponse) error
- func (h *NodeServiceHandler) WaitForResult(ctx context.Context, nodeID string, taskID string) (*pb.DispatchTaskResponse, error)
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 ¶
func (h *AdminServiceHandler) CordonNode(ctx context.Context, req *pb.CordonNodeRequest) (*pb.CordonNodeResponse, error)
CordonNode marks a Golem node as unschedulable.
func (*AdminServiceHandler) CreateToken ¶
func (h *AdminServiceHandler) CreateToken(ctx context.Context, req *pb.CreateTokenRequest) (*pb.CreateTokenResponse, error)
CreateToken creates a new Bootstrap Token.
func (*AdminServiceHandler) DeleteToken ¶
func (h *AdminServiceHandler) DeleteToken(ctx context.Context, req *pb.DeleteTokenRequest) (*pb.DeleteTokenResponse, error)
DeleteToken deletes a Bootstrap Token.
func (*AdminServiceHandler) GetNode ¶
func (h *AdminServiceHandler) GetNode(ctx context.Context, req *pb.GetNodeRequest) (*pb.GetNodeResponse, error)
GetNode returns details of a single Golem node.
func (*AdminServiceHandler) ListNodes ¶
func (h *AdminServiceHandler) ListNodes(ctx context.Context, req *pb.ListNodesRequest) (*pb.ListNodesResponse, error)
ListNodes returns a list of registered Golem nodes.
func (*AdminServiceHandler) ListTokens ¶
func (h *AdminServiceHandler) ListTokens(ctx context.Context, req *pb.ListTokensRequest) (*pb.ListTokensResponse, error)
ListTokens lists all Bootstrap Tokens.
func (*AdminServiceHandler) UncordonNode ¶
func (h *AdminServiceHandler) UncordonNode(ctx context.Context, req *pb.UncordonNodeRequest) (*pb.UncordonNodeResponse, error)
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 ¶
func (h *NodeServiceHandler) Deregister(ctx context.Context, req *pb.DeregisterRequest) (*pb.DeregisterResponse, error)
Deregister handles a Golem node deregistration request.
func (*NodeServiceHandler) Heartbeat ¶
func (h *NodeServiceHandler) Heartbeat(stream pb.GolemNodeService_HeartbeatServer) error
Heartbeat handles the bidirectional heartbeat stream. It also acts as the channel for dispatching tasks to the Golem node.
func (*NodeServiceHandler) Register ¶
func (h *NodeServiceHandler) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.RegisterResponse, error)
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 ¶
func (h *NodeServiceHandler) ReportTaskProgress(ctx context.Context, req *pb.ReportTaskProgressRequest) (*pb.ReportTaskProgressResponse, error)
ReportTaskProgress handles a task progress update from Golem.
func (*NodeServiceHandler) ReportTaskResult ¶
func (h *NodeServiceHandler) ReportTaskResult(ctx context.Context, req *pb.ReportTaskResultRequest) (*pb.ReportTaskResultResponse, error)
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.