Struct libp2p::kad::QueryStats
source · pub struct QueryStats { /* private fields */ }
Expand description
Execution statistics of a query.
Implementations§
source§impl QueryStats
impl QueryStats
pub fn empty() -> QueryStats
sourcepub fn num_requests(&self) -> u32
pub fn num_requests(&self) -> u32
Gets the total number of requests initiated by the query.
sourcepub fn num_successes(&self) -> u32
pub fn num_successes(&self) -> u32
Gets the number of successful requests.
sourcepub fn num_failures(&self) -> u32
pub fn num_failures(&self) -> u32
Gets the number of failed requests.
sourcepub fn num_pending(&self) -> u32
pub fn num_pending(&self) -> u32
Gets the number of pending requests.
Note: A query can finish while still having pending requests, if the termination conditions are already met.
sourcepub fn duration(&self) -> Option<Duration>
pub fn duration(&self) -> Option<Duration>
Gets the duration of the query.
If the query has not yet finished, the duration is measured from the start of the query to the current instant.
If the query did not yet start (i.e. yield the first peer to contact),
None
is returned.
sourcepub fn merge(self, other: QueryStats) -> QueryStats
pub fn merge(self, other: QueryStats) -> QueryStats
Merges these stats with the given stats of another query, e.g. to accumulate statistics from a multi-phase query.
Counters are merged cumulatively while the instants for start and end of the queries are taken as the minimum and maximum, respectively.
Trait Implementations§
source§impl Clone for QueryStats
impl Clone for QueryStats
source§fn clone(&self) -> QueryStats
fn clone(&self) -> QueryStats
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for QueryStats
impl Debug for QueryStats
source§impl PartialEq<QueryStats> for QueryStats
impl PartialEq<QueryStats> for QueryStats
source§fn eq(&self, other: &QueryStats) -> bool
fn eq(&self, other: &QueryStats) -> bool
self
and other
values to be equal, and is used
by ==
.