daemon

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 16 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 NewControlPlaneHandler added in v0.5.0

func NewControlPlaneHandler(
	pool *herd.Pool[*http.Client],
	lifecycleManager *lifecycle.Manager,
	proxyAddress string,
	logger *EventLogger,
) http.Handler

func NewDataPlaneHandler

func NewDataPlaneHandler(pool *herd.Pool[*http.Client], lm *lifecycle.Manager, 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 RecordSessionDraining added in v0.5.0

func RecordSessionDraining()

func RecordSessionKilled

func RecordSessionKilled()

func RecordSessionResumed added in v0.5.0

func RecordSessionResumed()

func RecordSessionStarted

func RecordSessionStarted()

func RemoveUnixSocket

func RemoveUnixSocket(path string) error

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

Types

type ControlPlaneHandler added in v0.5.0

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

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
	SessionsDraining int64 // current sessions in grace period (gauge)
}

func SnapshotLifecycleCounters

func SnapshotLifecycleCounters() LifecycleSnapshot

type SessionCreateRequest added in v0.5.0

type SessionCreateRequest struct {
	Image              string            `json:"image"`
	Command            []string          `json:"command,omitempty"`
	Env                map[string]string `json:"env,omitempty"`
	IdleTimeoutSeconds int               `json:"idle_timeout_seconds,omitempty"`
	TTLSeconds         int               `json:"ttl_seconds,omitempty"`
	HealthInterval     string            `json:"health_interval,omitempty"`
	Warm               bool              `json:"warm,omitempty"`
}

SessionCreateRequest is the JSON body for POST /v1/sessions It acts as the TenantDeploymentConfig.

type SessionCreateResponse added in v0.5.0

type SessionCreateResponse struct {
	SessionID    string `json:"session_id"`
	InternalIP   string `json:"internal_ip"`
	ProxyAddress string `json:"proxy_address"`
}

SessionCreateResponse is the JSON response

Jump to

Keyboard shortcuts

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