pub struct TopologyModel { /* private fields */ }Expand description
The held topology and the revision of its latest document.
Implementations§
Source§impl TopologyModel
impl TopologyModel
Sourcepub fn document(
&self,
wall: &WallBase,
) -> (TopologyDocument, Option<ConsoleError>)
pub fn document( &self, wall: &WallBase, ) -> (TopologyDocument, Option<ConsoleError>)
The whole document as it stands, always. This device’s start is wall
time from wall, the same whenever the document is built, so a reader
derives the uptime on its own clock and a document never goes stale.
When the start falls outside u64 milliseconds since the epoch, the
document names that fault where the start would be, and the fault
comes back beside it for the caller to count: one bad reading never
withholds the topology.
Source§impl TopologyModel
impl TopologyModel
Sourcepub fn new(
this: ThisDevice,
stations: impl IntoIterator<Item = String>,
lines: impl IntoIterator<Item = (String, LineLife, LineState)>,
connections: impl IntoIterator<Item = (u64, Mount, Option<String>)>,
peers: impl IntoIterator<Item = String>,
) -> Self
pub fn new( this: ThisDevice, stations: impl IntoIterator<Item = String>, lines: impl IntoIterator<Item = (String, LineLife, LineState)>, connections: impl IntoIterator<Item = (u64, Mount, Option<String>)>, peers: impl IntoIterator<Item = String>, ) -> Self
The model at start, revision 1, from what the server already holds.
console.* channels are never lines.
Sourcepub fn with_machine(self, machine: &MachineConfig) -> Self
pub fn with_machine(self, machine: &MachineConfig) -> Self
Reads this device’s district parent from its machine configuration.
Sourcepub fn apply(&mut self, change: TopologyChange) -> bool
pub fn apply(&mut self, change: TopologyChange) -> bool
Applies change. A change that alters the topology moves the revision
on by one and answers true; one that alters nothing (a repeat, or a
console.* channel) leaves it and answers false, so nothing is
published for it.
Sourcepub fn reserved(&self, id: &str) -> Option<&'static str>
pub fn reserved(&self, id: &str) -> Option<&'static str>
The station id would collide with: this server’s exchange (its
device id), or its depot when it keeps one. A worker or service with
such an id is kept off the map, never merged into that station
(Buttercup’s V1, Hermes 04:27).
Sourcepub fn incarnation_started(&mut self, started: Instant) -> bool
pub fn incarnation_started(&mut self, started: Instant) -> bool
This server’s incarnation started at started: its uptime runs
from there (SRV-012 R7). Answers whether that moved it.