pub struct NetworkVisualizer { /* private fields */ }Expand description
Network metrics collector for visualization.
Implementations§
Source§impl NetworkVisualizer
impl NetworkVisualizer
Sourcepub fn set_local_user_id(&mut self, local_user_id: impl Into<String>)
pub fn set_local_user_id(&mut self, local_user_id: impl Into<String>)
Replaces the local user id reported in the topology.
Exists because the visualizer is constructed before this device has an
identity: the address is derived during initialize_mls, so the
visualizer starts on the pre-identity placeholder and has to be told
the real value once it exists. Without this the topology reports the
local profile — a storage-namespace selector that is never supposed
to leave the device — as though it were this device’s peer id.
Sourcepub fn update_node(&mut self, node: NetworkNode)
pub fn update_node(&mut self, node: NetworkNode)
Registers or updates a node in the topology.
Sourcepub fn add_link(&mut self, link: NetworkLink)
pub fn add_link(&mut self, link: NetworkLink)
Adds a link between two nodes.
Sourcepub fn remove_link(&mut self, from: &str, to: &str)
pub fn remove_link(&mut self, from: &str, to: &str)
Removes a link between two nodes.
Sourcepub fn record_message(&mut self, stats: MessageStats)
pub fn record_message(&mut self, stats: MessageStats)
Records a message delivery attempt.
Sourcepub fn get_topology(&self) -> NetworkTopology
pub fn get_topology(&self) -> NetworkTopology
Generates a network topology snapshot.
Sourcepub fn export_json(&self) -> Result<String>
pub fn export_json(&self) -> Result<String>
Exports topology as JSON.
Sourcepub fn get_message_stats(&self) -> Vec<MessageStats>
pub fn get_message_stats(&self) -> Vec<MessageStats>
Gets message delivery statistics.
Sourcepub fn delivery_success_rate(&self) -> f32
pub fn delivery_success_rate(&self) -> f32
Calculates delivery success rate.
Sourcepub fn median_latency(&self) -> Option<u64>
pub fn median_latency(&self) -> Option<u64>
Calculates median delivery latency.
Sourcepub fn median_hops(&self) -> Option<u8>
pub fn median_hops(&self) -> Option<u8>
Calculates median hop count.
Auto Trait Implementations§
impl Freeze for NetworkVisualizer
impl RefUnwindSafe for NetworkVisualizer
impl Send for NetworkVisualizer
impl Sync for NetworkVisualizer
impl Unpin for NetworkVisualizer
impl UnsafeUnpin for NetworkVisualizer
impl UnwindSafe for NetworkVisualizer
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
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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