pub(in engine) struct RouteGraph {
entries: BTreeMap<SubscriptionKey, Subscription>,
by_receiver: BTreeMap<UserId, BTreeSet<SubscriptionKey>>,
by_source: BTreeMap<PublishedSourceId, BTreeSet<SubscriptionKey>>,
next_reservation: RouteReservationId,
pending_targets: BTreeMap<UserId, VecDeque<UserId>>,
pending_target_limit: usize,
}Fields§
§entries: BTreeMap<SubscriptionKey, Subscription>§by_receiver: BTreeMap<UserId, BTreeSet<SubscriptionKey>>§by_source: BTreeMap<PublishedSourceId, BTreeSet<SubscriptionKey>>§next_reservation: RouteReservationId§pending_targets: BTreeMap<UserId, VecDeque<UserId>>§pending_target_limit: usizeImplementations§
Source§impl RouteGraph
impl RouteGraph
pub(super) fn new(pending_target_limit: usize) -> Self
Sourcepub(super) fn publisher_joined(&mut self, publisher: &UserId)
pub(super) fn publisher_joined(&mut self, publisher: &UserId)
Membership promotion preserves every stream preference and frees its absent-target allowance without duplicating the logical subscriptions.
Sourcepub(super) fn publisher_left(&mut self, publisher: &UserId) -> usize
pub(super) fn publisher_left(&mut self, publisher: &UserId) -> usize
Call after detaching every source and removing this user’s receiver state. A departed member becomes the newest absent target for each receiver retaining explicit intent, even when it never published media.
fn retain_pending_target( &mut self, receiver: &UserId, publisher: &UserId, ) -> usize
pub(super) fn subscription_count(&self) -> usize
Sourcepub(in engine) fn consumer_count(
&self,
) -> usize
pub(in engine) fn consumer_count( &self, ) -> usize
Counts committed consumers, including inactive subscriptions.
pub(super) fn merge_intent( &mut self, key: &SubscriptionKey, update: SourceSubscriptionIntent, publisher_present: bool, ) -> usize
Sourcepub(in engine) fn intent(
&self,
key: &SubscriptionKey,
) -> SourceSubscriptionIntent
pub(in engine) fn intent( &self, key: &SubscriptionKey, ) -> SourceSubscriptionIntent
Returns merged receiver intent or the default for a missing subscription.
pub(super) fn attach_for_setup( &mut self, key: SubscriptionKey, source_id: PublishedSourceId, ) -> bool
Sourcepub(super) fn attached_allocation_mut(
&mut self,
key: &SubscriptionKey,
source_id: PublishedSourceId,
connection_id: ConnectionId,
) -> Option<&mut RouteAllocation>
pub(super) fn attached_allocation_mut( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, connection_id: ConnectionId, ) -> Option<&mut RouteAllocation>
Returns None unless the attachment matches source_id and any
committed route serves connection_id.
pub(super) fn reserve_consumer_setup( &mut self, key: SubscriptionKey, source_id: PublishedSourceId, allocation: RouteAllocation, ) -> Option<ConsumerRouteReservation>
pub(super) fn release_consumer_setup( &mut self, reservation: &ConsumerRouteReservation, )
Sourcepub(super) fn commit(
&mut self,
reservation: ConsumerRouteReservation,
route: TransportConsumerRoute,
allocation: RouteAllocation,
) -> bool
pub(super) fn commit( &mut self, reservation: ConsumerRouteReservation, route: TransportConsumerRoute, allocation: RouteAllocation, ) -> bool
Returns whether the route committed.
pub(super) fn update_allocation( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, route: &TransportConsumerRoute, update: impl FnOnce(&mut RouteAllocation), ) -> bool
pub(super) fn update_upgrade( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, route: &TransportConsumerRoute, pending_upgrade: Option<PendingUpgrade>, ) -> bool
pub(super) fn clear_source_upgrades(&mut self, source_id: PublishedSourceId)
Sourcepub(super) fn allocation(
&self,
key: &SubscriptionKey,
source_id: PublishedSourceId,
) -> Option<RouteAllocation>
pub(super) fn allocation( &self, key: &SubscriptionKey, source_id: PublishedSourceId, ) -> Option<RouteAllocation>
Returns None when the attached source differs from source_id.
pub(super) fn attached( &self, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>
pub(super) fn current( &self, key: &SubscriptionKey, ) -> Option<(&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>
pub(super) fn attached_for_receiver( &self, receiver: &UserId, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>
pub(super) fn attached_for_source( &self, source_id: PublishedSourceId, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>
pub(super) fn detach_source( &mut self, source_id: PublishedSourceId, ) -> Vec<TransportConsumerRoute>
pub(super) fn reset_receiver_for_replacement(&mut self, receiver: &UserId)
pub(super) fn remove_receiver( &mut self, receiver: &UserId, ) -> Vec<TransportConsumerRoute>
pub(super) fn detach_declined_consumers( &mut self, session: &TransportSessionKey, declined: &[TransportMediaId], ) -> Vec<TransportConsumerRoute>
fn entry(&mut self, key: SubscriptionKey) -> &mut Subscription
fn current_mut( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, ) -> Option<&mut CurrentPublication>
Sourcefn reserved_mut(
&mut self,
reservation: &ConsumerRouteReservation,
) -> Option<&mut CurrentPublication>
fn reserved_mut( &mut self, reservation: &ConsumerRouteReservation, ) -> Option<&mut CurrentPublication>
Returns the attachment only while reservation is its pending realization.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RouteGraph
impl RefUnwindSafe for RouteGraph
impl Send for RouteGraph
impl Sync for RouteGraph
impl Unpin for RouteGraph
impl UnsafeUnpin for RouteGraph
impl UnwindSafe for RouteGraph
Blanket Implementations§
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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