pub struct BridgeManager<K = ConnectionId, I = BridgeId>{ /* private fields */ }Expand description
Per-process registry of active media bridges.
Backed by DashMap for lock-free concurrent reads/writes plus a secondary
by_owner index for O(1) “which bridge is this owner in?” lookups (used
by hangup / teardown paths). The primary map stores the handle alongside
the owning key so BridgeManager::remove can keep both indices coherent
without an extra parameter.
Generic parameters:
K: owner key (e.g.ConnectionIdfor cross-transport,CallIdfor SIP-only orchestration-core).I: bridge identifier type (defaults to rvoip-core’sBridgeId; orchestration-core overrides with its ownBridgeIdfor the carve transition).
Implementations§
Source§impl<K, I> BridgeManager<K, I>
impl<K, I> BridgeManager<K, I>
pub fn new() -> Self
pub fn insert(&self, bridge_id: I, owner: K, handle: BridgeHandle)
Sourcepub fn remove(&self, bridge_id: &I) -> Option<BridgeHandle>
pub fn remove(&self, bridge_id: &I) -> Option<BridgeHandle>
Removes the bridge and returns the BridgeHandle (whose Drop
tears the bridge down). Keeps the secondary index coherent.
Sourcepub fn bridge_for_owner(&self, owner: &K) -> Option<I>
pub fn bridge_for_owner(&self, owner: &K) -> Option<I>
O(1) lookup: which active bridge (if any) is this owner in?
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<K, I> Clone for BridgeManager<K, I>
impl<K, I> Clone for BridgeManager<K, I>
Auto Trait Implementations§
impl<K = ConnectionId, I = BridgeId> !RefUnwindSafe for BridgeManager<K, I>
impl<K = ConnectionId, I = BridgeId> !UnwindSafe for BridgeManager<K, I>
impl<K, I> Freeze for BridgeManager<K, I>
impl<K, I> Send for BridgeManager<K, I>
impl<K, I> Sync for BridgeManager<K, I>
impl<K, I> Unpin for BridgeManager<K, I>
impl<K, I> UnsafeUnpin for BridgeManager<K, I>
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