Skip to main content

Module ServiceInfo

Module ServiceInfo 

Source
Expand description

§Service Discovery and Information

Tracks every service Mountain talks to: its lifecycle state, performance counters, dependency graph, and (optionally) a network endpoint. Used by the in-process service registry to make health- based routing decisions.

Layout (one export per file, file name = identity):

  • ServiceState::Enum - Running / Degraded / Stopped / Error / Starting / ShuttingDown.
  • ServicePerformance::Struct - request/error counters + rolling mean response latency.
  • ServiceEndpoint::Struct - protocol/host/port (+ UDS path).
  • ServiceInfo::Struct - the per-service descriptor.
  • ServiceRegistry::Struct - discovery-cadence-aware map keyed by service name.

TODO: zero callers as of 2026-05-02. Pending wire-up from the gRPC and Tauri IPC dispatch hot paths.

Modules§

ServiceEndpoint
Network endpoint metadata: protocol, host, port, optional Unix-domain socket path. NewUnix is the convenience constructor for the UDS-only path; everything else uses the four-arg new.
ServiceInfo
Per-service descriptor: name, version, lifecycle state, performance counters, dependency list, optional endpoint. Health is the conjunction of operational state, recent heartbeat (≤ 30s), and error rate ≤ 10 %.
ServicePerformance
Per-service request/error counters and a rolling-mean response latency. RecordRequest updates the running average using (prev * (n-1) + new) / n so the value stays bounded under high request volume.
ServiceRegistry
Map of registered services keyed by name + a configurable discovery cadence. ShouldDiscover returns true once the configured interval has elapsed since the last MarkDiscovery (or Register / Unregister, both of which stamp the timestamp implicitly).
ServiceState
Lifecycle state of a service. IsOperational covers the three states a caller can still send work to (Running / Degraded / Starting); the rest are terminal or transitional.