pub struct MeshRuntimeState<P> {
pub peers: Arc<RwLock<HashMap<String, MeshPeerEntry<P>>>>,
pub connected_count: Arc<AtomicUsize>,
pub bytes_sent: AtomicU64,
pub bytes_received: AtomicU64,
pub mesh_received: AtomicU64,
pub mesh_forwarded: AtomicU64,
pub mesh_dropped_duplicate: AtomicU64,
/* private fields */
}Expand description
Shared runtime state for transport-backed mesh peers.
Fields§
§peers: Arc<RwLock<HashMap<String, MeshPeerEntry<P>>>>§connected_count: Arc<AtomicUsize>§bytes_sent: AtomicU64§bytes_received: AtomicU64§mesh_received: AtomicU64§mesh_forwarded: AtomicU64§mesh_dropped_duplicate: AtomicU64Implementations§
Source§impl<P> MeshRuntimeState<P>
impl<P> MeshRuntimeState<P>
pub fn new() -> Self
pub async fn set_local_buses(&self, buses: Vec<SharedLocalNostrBus>)
pub async fn add_local_bus(&self, bus: SharedLocalNostrBus)
pub async fn local_buses(&self) -> Vec<SharedLocalNostrBus> ⓘ
pub async fn reset(&self)
pub fn get_bandwidth(&self) -> (u64, u64)
pub fn get_mesh_stats(&self) -> (u64, u64, u64)
pub fn record_mesh_received(&self)
pub fn record_mesh_forwarded(&self, count: u64)
pub fn record_mesh_duplicate_drop(&self)
pub async fn record_sent(&self, peer_id: &str, bytes: u64)
pub async fn record_received(&self, peer_id: &str, bytes: u64)
pub async fn resolve_root_from_local_buses_with_source( &self, owner_pubkey: &str, tree_name: &str, timeout: Duration, ) -> Option<(&'static str, PeerRootEvent)>
pub async fn resolve_root_from_local_buses( &self, owner_pubkey: &str, tree_name: &str, timeout: Duration, ) -> Option<PeerRootEvent>
Trait Implementations§
Auto Trait Implementations§
impl<P> !Freeze for MeshRuntimeState<P>
impl<P> !RefUnwindSafe for MeshRuntimeState<P>
impl<P> Send for MeshRuntimeState<P>
impl<P> Sync for MeshRuntimeState<P>
impl<P> Unpin for MeshRuntimeState<P>
impl<P> UnsafeUnpin for MeshRuntimeState<P>
impl<P> !UnwindSafe for MeshRuntimeState<P>
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> 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<'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> 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