pub struct PidRecord {Show 15 fields
pub pid: u32,
pub started_at_unix_secs: u64,
pub binary_sha256: String,
pub version: String,
pub commit: String,
pub state: IncarnationState,
pub http_address: Option<SocketAddr>,
pub grpc_address: Option<SocketAddr>,
pub intended_http_address: Option<SocketAddr>,
pub intended_grpc_address: Option<SocketAddr>,
pub stage: Option<String>,
pub stage_detail: Option<String>,
pub stage_seq: u64,
pub stage_updated_at_unix_secs: u64,
pub drain_timeout_seconds: u64,
}Expand description
The pid file’s content: one JSON object describing the server incarnation that claimed the home.
Fields§
§pid: u32Operating-system process id of the serving process.
started_at_unix_secs: u64The process start instant in whole seconds since the Unix epoch, read
through the process-table instrument (sysinfo) at boot. Verifiers
compare this against the SAME instrument’s answer for the live pid, so
the check is exact equality, not clock arithmetic: a reused pid wears
a different start instant.
binary_sha256: StringSHA-256 of the serving binary’s bytes, hashed from the executable path at boot. This records WHICH build claimed the home; it is not a liveness discriminator (an upgrade that swaps the binary by rename changes the file on disk while the process keeps its old image).
version: StringCrate version of the serving binary (CARGO_PKG_VERSION at build).
commit: StringSource commit of the serving binary, from
crate::build_identity::BuildIdentity.
state: IncarnationStateWhere this incarnation is in its own life. Defaulted on read
(module-header ruling) to IncarnationState::Serving.
http_address: Option<SocketAddr>HTTP address the server actually bound — recorded so status probes
the running server’s own listener even when the config file has been
edited since boot. None while the incarnation is still
Booting: nothing is bound yet, and an
address recorded before the bind would be a promise, not a fact.
grpc_address: Option<SocketAddr>gRPC address the server actually bound, recorded for the same reason
and None for the same window.
intended_http_address: Option<SocketAddr>HTTP address this incarnation’s already-loaded configuration says it
WILL bind — a promise by name, recorded at birth precisely because it
is one. The bound pair above stays the fact about open doors; this
pair exists so a SECOND boot arriving mid-recovery can decide
collision against the holder’s configuration instead of presuming it:
two explicit configs on one home with different doors are two servers,
and the second must boot unclaimed rather than refuse. None only in
a record written by a build that predates the field, where the honest
reading remains “unknowable, presume collision”.
intended_grpc_address: Option<SocketAddr>gRPC counterpart of intended_http_address, same birth, same reason.
stage: Option<String>The boot stage this incarnation is working through, as a machine
token: config, store-open, writer-lock-wait, wal-recovery,
engine-recovery, binding. None once the boot is done.
stage_detail: Option<String>One human sentence about the current stage — “materializing shard 17
of 64”, “waiting 40s on the store writer lock at
stage_seq: u64Incremented on EVERY stage write. Readers watch it to distinguish a boot that is PROGRESSING from one that is STUCK — two facts a bare stage token cannot tell apart, and the difference between “wait” and “something is wrong”.
stage_updated_at_unix_secs: u64When the last stage write landed, in whole seconds since the Unix epoch. Wall-clock, because the reader is a different process: a monotonic instant does not cross the process boundary.
drain_timeout_seconds: u64The drain window this incarnation is actually running with, in whole
seconds — recorded for the same reason as the addresses: the running
server’s window may have come from its own command line
(--drain-timeout) or from a config file edited since boot, and a
stop verb that waited out a re-derived value would misreport a healthy
long drain as “still draining” (or force it on a second invocation).
Defaulted on read (module-header ruling): a record written by a build
that predates this field — or by an incarnation still BOOTING, which
has not resolved its runtime config yet — reads as 0, which patience
resolution treats as “no recorded window” and falls through to config.
Implementations§
Source§impl PidRecord
impl PidRecord
Sourcepub const fn identity(&self) -> (u32, u64)
pub const fn identity(&self) -> (u32, u64)
This record’s incarnation identity: the pid and the start instant, which together name exactly one process on exactly one boot of the machine.
This — never whole-record equality — is what every compare-and-act path uses (module-header ruling). The rest of the record mutates while the incarnation lives.
Sourcepub fn is_same_incarnation(&self, other: &Self) -> bool
pub fn is_same_incarnation(&self, other: &Self) -> bool
Whether self and other name the same incarnation.
Sourcepub fn running_for_secs(&self) -> u64
pub fn running_for_secs(&self) -> u64
How long ago this incarnation started, in whole seconds, against the reader’s own wall clock. Saturating: a record from a machine whose clock has since moved backwards reports 0 rather than an absurdity.
Sourcepub fn stage_age_secs(&self) -> Option<u64>
pub fn stage_age_secs(&self) -> Option<u64>
How long ago the last stage write landed, in whole seconds, or None
when no stage has ever been written (a record from a build predating
stages, or an incarnation that never reported one).
Sourcepub fn stage_line(&self) -> Option<String>
pub fn stage_line(&self) -> Option<String>
The stage rendered for an operator: wal-recovery — materializing shard 17 of 64, or just the token when no detail was written, or
None when no stage has been reported at all.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PidRecord
impl<'de> Deserialize<'de> for PidRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PidRecord
impl StructuralPartialEq for PidRecord
Auto Trait Implementations§
impl Freeze for PidRecord
impl RefUnwindSafe for PidRecord
impl Send for PidRecord
impl Sync for PidRecord
impl Unpin for PidRecord
impl UnsafeUnpin for PidRecord
impl UnwindSafe for PidRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<M> EmbeddedConversationMessage for Mwhere
M: Serialize,
impl<M> EmbeddedConversationMessage for Mwhere
M: Serialize,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request