pub struct NetworkState { /* private fields */ }Expand description
Local in-memory view of all known nodes in all joined networks.
Implementations§
Source§impl NetworkState
impl NetworkState
pub fn new() -> Self
Sourcepub fn upsert(&mut self, info: NodeInfo)
pub fn upsert(&mut self, info: NodeInfo)
Upsert (or insert) a NodeInfo, keeping the newest announcement.
Sourcepub fn in_network<'a>(&'a self, network_id: &str) -> Vec<&'a NodeInfo>
pub fn in_network<'a>(&'a self, network_id: &str) -> Vec<&'a NodeInfo>
All nodes in a specific network.
Sourcepub fn evict_stale(&mut self, max_age_secs: u64)
pub fn evict_stale(&mut self, max_age_secs: u64)
Evict nodes whose last announcement is older than max_age_secs.
Trait Implementations§
Source§impl Default for NetworkState
impl Default for NetworkState
Source§fn default() -> NetworkState
fn default() -> NetworkState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NetworkState
impl RefUnwindSafe for NetworkState
impl Send for NetworkState
impl Sync for NetworkState
impl Unpin for NetworkState
impl UnwindSafe for NetworkState
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more