pub struct WebRTCState {
pub runtime: MeshRuntimeState<MeshPeer>,
/* private fields */
}Expand description
Shared state for the native mesh router.
Fields§
§runtime: MeshRuntimeState<MeshPeer>Implementations§
Source§impl WebRTCState
impl WebRTCState
pub fn new() -> WebRTCState
pub fn new_with_routing( selection_strategy: SelectionStrategy, fairness_enabled: bool, request_dispatch: RequestDispatchConfig, ) -> WebRTCState
pub fn new_with_routing_and_cashu( selection_strategy: SelectionStrategy, fairness_enabled: bool, request_dispatch: RequestDispatchConfig, request_timeout: Duration, cashu_routing: CashuRoutingConfig, payment_client: Option<Arc<dyn CashuPaymentClient>>, mint_metadata: Option<Arc<CashuMintMetadataStore>>, ) -> WebRTCState
pub async fn set_local_buses(&self, buses: Vec<Arc<dyn LocalNostrBus>>)
pub async fn add_local_bus(&self, bus: Arc<dyn LocalNostrBus>)
pub async fn set_multicast_bus(&self, bus: Option<Arc<MulticastNostrBus>>)
Sourcepub async fn reset_runtime_state(&self)
pub async fn reset_runtime_state(&self)
Drop all live peer sessions and clear topology-specific state while keeping cumulative bandwidth counters intact.
Sourcepub fn get_bandwidth(&self) -> (u64, u64)
pub fn get_bandwidth(&self) -> (u64, u64)
Get current bandwidth stats (bytes sent/received)
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)
Sourcepub async fn record_sent(&self, peer_id: &str, bytes: u64)
pub async fn record_sent(&self, peer_id: &str, bytes: u64)
Record bytes sent (global + per-peer)
Sourcepub async fn record_received(&self, peer_id: &str, bytes: u64)
pub async fn record_received(&self, peer_id: &str, bytes: u64)
Record bytes received (global + per-peer)
Sourcepub async fn request_from_peers(&self, hash_hex: &str) -> Option<Vec<u8>>
pub async fn request_from_peers(&self, hash_hex: &str) -> Option<Vec<u8>>
Request content by hash from connected peers Queries peers in adaptive selector order with hedged fanout waves. Returns the first successful response, or None if no peer has it
Sourcepub async fn request_from_peers_with_source(
&self,
hash_hex: &str,
) -> Option<(Vec<u8>, String)>
pub async fn request_from_peers_with_source( &self, hash_hex: &str, ) -> Option<(Vec<u8>, String)>
Request content by hash from connected peers, returning data and source peer.
Sourcepub async fn resolve_root_from_peers(
&self,
owner_pubkey: &str,
tree_name: &str,
per_peer_timeout: Duration,
) -> Option<PeerRootEvent>
pub async fn resolve_root_from_peers( &self, owner_pubkey: &str, tree_name: &str, per_peer_timeout: Duration, ) -> Option<PeerRootEvent>
Resolve a hashtree root event through connected peers using Nostr REQ/EOSE over WebRTC.
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>
pub async fn resolve_root_from_multicast( &self, owner_pubkey: &str, tree_name: &str, timeout: Duration, ) -> Option<PeerRootEvent>
Trait Implementations§
Source§impl Default for WebRTCState
impl Default for WebRTCState
Source§fn default() -> WebRTCState
fn default() -> WebRTCState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for WebRTCState
impl !RefUnwindSafe for WebRTCState
impl Send for WebRTCState
impl Sync for WebRTCState
impl Unpin for WebRTCState
impl UnsafeUnpin for WebRTCState
impl !UnwindSafe for WebRTCState
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