Skip to main content

PidRecord

Struct PidRecord 

Source
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: u32

Operating-system process id of the serving process.

§started_at_unix_secs: u64

The 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: String

SHA-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: String

Crate version of the serving binary (CARGO_PKG_VERSION at build).

§commit: String

Source commit of the serving binary, from crate::build_identity::BuildIdentity.

§state: IncarnationState

Where 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 ”. The token above is what a script keys on; this is what an operator reads.

§stage_seq: u64

Incremented 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: u64

When 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: u64

The 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

Source

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.

Source

pub fn is_same_incarnation(&self, other: &Self) -> bool

Whether self and other name the same incarnation.

Source

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.

Source

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).

Source

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 Clone for PidRecord

Source§

fn clone(&self) -> PidRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PidRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PidRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for PidRecord

Source§

impl PartialEq for PidRecord

Source§

fn eq(&self, other: &PidRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PidRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PidRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<M> EmbeddedConversationMessage for M
where M: Serialize,

Source§

fn type_name(&self) -> &'static str

Returns the Rust type name used for diagnostics and backend routing.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more