pub struct PubsubStats {
pub num_topics: u64,
pub num_peers: u64,
pub messages_received: u64,
pub messages_sent: u64,
pub bytes_received: u64,
pub bytes_sent: u64,
}Expand description
PubSub statistics.
§Kubo Equivalent
Statistics about pubsub operation, similar to what would be
returned by a hypothetical ipfs stats pubsub command.
Fields§
§num_topics: u64Number of topics subscribed to.
num_peers: u64Number of peers across all topics.
messages_received: u64Number of messages received.
messages_sent: u64Number of messages sent.
bytes_received: u64Total bytes received.
bytes_sent: u64Total bytes sent.
Implementations§
Source§impl PubsubStats
impl PubsubStats
Sourcepub fn new(
num_topics: u64,
num_peers: u64,
messages_received: u64,
messages_sent: u64,
bytes_received: u64,
bytes_sent: u64,
) -> Self
pub fn new( num_topics: u64, num_peers: u64, messages_received: u64, messages_sent: u64, bytes_received: u64, bytes_sent: u64, ) -> Self
Create new stats with all values specified.
§Arguments
num_topics- Number of subscribed topicsnum_peers- Number of connected peersmessages_received- Count of received messagesmessages_sent- Count of sent messagesbytes_received- Total bytes receivedbytes_sent- Total bytes sent
Sourcepub fn record_received(&mut self, bytes: u64)
pub fn record_received(&mut self, bytes: u64)
Record a received message.
Sourcepub fn record_sent(&mut self, bytes: u64)
pub fn record_sent(&mut self, bytes: u64)
Record a sent message.
Trait Implementations§
Source§impl Clone for PubsubStats
impl Clone for PubsubStats
Source§fn clone(&self) -> PubsubStats
fn clone(&self) -> PubsubStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PubsubStats
impl Debug for PubsubStats
Source§impl Default for PubsubStats
impl Default for PubsubStats
Source§fn default() -> PubsubStats
fn default() -> PubsubStats
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PubsubStats
impl<'de> Deserialize<'de> for PubsubStats
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PubsubStats
impl RefUnwindSafe for PubsubStats
impl Send for PubsubStats
impl Sync for PubsubStats
impl Unpin for PubsubStats
impl UnwindSafe for PubsubStats
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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