pub struct WebRTCState {
pub peers: RwLock<HashMap<String, PeerEntry>>,
pub connected_count: 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 state for WebRTC manager
Fields§
§peers: RwLock<HashMap<String, PeerEntry>>§connected_count: AtomicUsize§bytes_sent: AtomicU64Total bytes sent across all peers (cumulative)
bytes_received: AtomicU64Total bytes received across all peers (cumulative)
mesh_received: AtomicU64Relayless mesh frames received and accepted.
mesh_forwarded: AtomicU64Relayless mesh frames forwarded to peers.
mesh_dropped_duplicate: AtomicU64Relayless mesh frames/events dropped due to dedupe.
Implementations§
Source§impl WebRTCState
impl WebRTCState
pub fn new() -> Self
pub fn new_with_routing( selection_strategy: SelectionStrategy, fairness_enabled: bool, request_dispatch: RequestDispatchConfig, ) -> Self
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>>, ) -> Self
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
Trait Implementations§
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