pub struct ServiceRecord {}Expand description
<suite>/runtime/<service>/service.json.
A superset of HeardRight’s ServiceRecord (protocol_major, protocol_minor,
role, pid, endpoint, engine_version): the fields HeardRight does not
write default on read, and engine_version is written alongside version
so an unchanged HeardRight client still parses a record written here.
Fields§
§protocol_major: u32§protocol_minor: u32§service: String§role: StringProduct label of the host (HeardRight: heard_right_shell, …).
rank: u8Lower rank wins the service. RANK_UNKNOWN when the writer gave none.
pid: u32§endpoint: StringUnix socket path or named-pipe name.
version: String§started_ms: u64Publication time (ms since epoch) of this record. HeardRight-compatible meaning; never used to validate the PID.
process_started_ms: u64Birth time of the owning process (ms since epoch), when the writer knows it. Only when present is it compared against the live process to reject a reused PID; records without it fall back to plain PID liveness.
engine_version: StringHeardRight’s name for version; mirrored so either reader works.
heartbeat_ms: u64Last heartbeat of the host (ms since epoch), rewritten by
ticker::spawn_record_heartbeat so a reader tells
a live host from a dead one without connecting (rightkit#404). Zero when the host never
beats; a reader then falls back to pid liveness.
state: StringThe host’s coarse state ("ready", "draining", …), whatever the host publishes with
its heartbeat. Empty when it publishes none. A label, never content.
Implementations§
Source§impl ServiceRecord
impl ServiceRecord
Sourcepub fn heartbeat_age_ms(&self, now_ms: u64) -> Option<u64>
pub fn heartbeat_age_ms(&self, now_ms: u64) -> Option<u64>
Milliseconds since this host last beat, as of now_ms; None when it never beat.
Sourcepub fn host_version(&self) -> &str
pub fn host_version(&self) -> &str
The host version, from whichever field the writer used.