daemon

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SessionHeader = "X-Session-ID"

Variables

This section is empty.

Functions

func EnforceRuntimePolicy

func EnforceRuntimePolicy(goos string, logger *log.Logger) error

EnforceRuntimePolicy validates platform support and emits guarantee warnings. Linux runs with full guarantees. macOS is supported in reduced-guarantee mode. Other operating systems fail fast at startup.

func ListenUnixSocket

func ListenUnixSocket(path string) (net.Listener, error)

ListenUnixSocket creates a UDS listener for the control plane. It removes stale socket files before binding and applies owner-only perms.

func MetricsHandler

func MetricsHandler(pool *herd.Pool[*http.Client]) http.Handler

MetricsHandler exposes a small Prometheus-compatible text endpoint.

func NewDataPlaneHandler

func NewDataPlaneHandler(pool *herd.Pool[*http.Client], metricsPath string) http.Handler

NewDataPlaneHandler builds the HTTP data-plane mux. - Proxy traffic is routed by X-Session-ID to session-affine workers. - /healthz reports daemon liveness. - telemetry metrics are exposed at metricsPath.

func RecordAcquireFailure

func RecordAcquireFailure()

func RecordAcquireRequest

func RecordAcquireRequest()

func RecordSessionKilled

func RecordSessionKilled()

func RecordSessionStarted

func RecordSessionStarted()

func RemoveUnixSocket

func RemoveUnixSocket(path string) error

RemoveUnixSocket removes a control-plane UDS file if it exists.

Types

type EventLogger

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

func NewEventLogger

func NewEventLogger(format string, logger *log.Logger) *EventLogger

func (*EventLogger) Error

func (l *EventLogger) Error(event string, fields map[string]any)

func (*EventLogger) Info

func (l *EventLogger) Info(event string, fields map[string]any)

func (*EventLogger) Warn

func (l *EventLogger) Warn(event string, fields map[string]any)

type LifecycleSnapshot

type LifecycleSnapshot struct {
	AcquireRequests uint64
	AcquireFailures uint64
	SessionsStarted uint64
	SessionsKilled  uint64
}

func SnapshotLifecycleCounters

func SnapshotLifecycleCounters() LifecycleSnapshot

type Server

type Server struct {
	pb.UnimplementedHerdServiceServer
	// contains filtered or unexported fields
}

Server implements the HerdService gRPC server.

func NewServer

func NewServer(pool *herd.Pool[*http.Client], proxyAddress string, maxWorkers int, logger *EventLogger) *Server

func (*Server) Acquire

func (s *Server) Acquire(stream pb.HerdService_AcquireServer) error

Acquire handles bidirectional streaming allocation.

func (*Server) Status

func (s *Server) Status(ctx context.Context, _ *emptypb.Empty) (*pb.StatusResponse, error)

Status returns daemon health metrics.

Jump to

Keyboard shortcuts

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