pub struct State {
pub orgs: Vec<Org>,
pub status: Status,
pub uptime_secs: Option<u64>,
pub demo: bool,
}Expand description
The complete language-neutral fleet snapshot served at GET /state.
This is the single source the dashboard renders from. It is byte-identical in every locale; the page supplies all words and formatting.
Fields§
§orgs: Vec<Org>The organizations in the fleet.
status: StatusThe fleet’s overall health, the worst across every group.
uptime_secs: Option<u64>Seconds the gateway has been running, if tracked.
demo: boolWhether this snapshot comes from the hardware-free demo, not a real device. The page shows demo-only affordances (the scenario switcher) only when this is set; a real device omits it.
Implementations§
Source§impl State
impl State
Sourcepub fn recompute_status(&mut self) -> Status
pub fn recompute_status(&mut self) -> Status
Sourcepub fn to_json(&self) -> Result<String, Error>
pub fn to_json(&self) -> Result<String, Error>
Serializes the snapshot to the compact JSON served at GET /state.
§Returns
The JSON text of the snapshot.
§Errors
Returns a serde_json::Error if the snapshot cannot be serialized, which in
practice only happens on a non-finite float.
Sourcepub fn from_json(json: &str) -> Result<Self, Error>
pub fn from_json(json: &str) -> Result<Self, Error>
Parses a snapshot from its JSON form, for restoring a persisted fleet on boot.
§Arguments
json- the JSON text of a previously serialized snapshot.
§Returns
The parsed State.
§Errors
Returns a serde_json::Error if the JSON is malformed or does not match the shape.