pub enum StreamLiveness {
Own,
Live,
Expired,
}Expand description
Whether a stream is speaking now, on this runtime’s clock. It is a verdict about a
stream and not about a link: a runtime reachable only through a relay is alive, and a
runtime that crashed stops beating for everyone at once. Own is kept apart from Live
because a runtime’s own stream needs no evidence — it is the thing doing the beating.
use majordomus_cli::mesh::journal::StreamLiveness;
assert!(StreamLiveness::Own.is_alive() && StreamLiveness::Live.is_alive());
assert!(!StreamLiveness::Expired.is_alive());
assert_eq!(
serde_json::to_value(StreamLiveness::Expired).unwrap(),
serde_json::json!("expired"),
);Variants§
Own
This runtime’s own current stream.
Live
Its beat rose within the expiry.
Expired
Its beat has not risen within the expiry, or was never heard.
Implementations§
Source§impl StreamLiveness
impl StreamLiveness
Sourcepub fn is_alive(self) -> bool
pub fn is_alive(self) -> bool
Whether the stream counts as alive: its claims hold, its sessions are present. The two living verdicts are collapsed here because everything downstream treats them alike — a claim of this runtime’s own and a claim of a peer that still beats both exclude — while the distinction is kept in the enum for anything that reports it.
use majordomus_cli::mesh::journal::StreamLiveness;
assert!(StreamLiveness::Own.is_alive(), "no evidence needed for one's own stream");
assert!(StreamLiveness::Live.is_alive());
assert!(!StreamLiveness::Expired.is_alive(), "its claims end without anyone releasing them");Trait Implementations§
Source§impl Clone for StreamLiveness
impl Clone for StreamLiveness
Source§fn clone(&self) -> StreamLiveness
fn clone(&self) -> StreamLiveness
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamLiveness
Source§impl Debug for StreamLiveness
impl Debug for StreamLiveness
Source§impl<'de> Deserialize<'de> for StreamLiveness
impl<'de> Deserialize<'de> for StreamLiveness
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 StreamLiveness
Source§impl JsonSchema for StreamLiveness
impl JsonSchema for StreamLiveness
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for StreamLiveness
impl PartialEq for StreamLiveness
Source§fn eq(&self, other: &StreamLiveness) -> bool
fn eq(&self, other: &StreamLiveness) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for StreamLiveness
impl Serialize for StreamLiveness
impl StructuralPartialEq for StreamLiveness
Auto Trait Implementations§
impl Freeze for StreamLiveness
impl RefUnwindSafe for StreamLiveness
impl Send for StreamLiveness
impl Sync for StreamLiveness
impl Unpin for StreamLiveness
impl UnsafeUnpin for StreamLiveness
impl UnwindSafe for StreamLiveness
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>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.