Skip to main content

RouteGraph

Struct RouteGraph 

Source
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: usize

Implementations§

Source§

impl RouteGraph

Source

pub(super) fn new(pending_target_limit: usize) -> Self

Source

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.

Source

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.

Source

fn retain_pending_target( &mut self, receiver: &UserId, publisher: &UserId, ) -> usize

Source

pub(super) fn subscription_count(&self) -> usize

Source

pub(in engine) fn consumer_count( &self, ) -> usize

Counts committed consumers, including inactive subscriptions.

Source

pub(super) fn merge_intent( &mut self, key: &SubscriptionKey, update: SourceSubscriptionIntent, publisher_present: bool, ) -> usize

Source

pub(in engine) fn intent( &self, key: &SubscriptionKey, ) -> SourceSubscriptionIntent

Returns merged receiver intent or the default for a missing subscription.

Source

pub(super) fn attach_for_setup( &mut self, key: SubscriptionKey, source_id: PublishedSourceId, ) -> bool

Source

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.

Source

pub(super) fn reserve_consumer_setup( &mut self, key: SubscriptionKey, source_id: PublishedSourceId, allocation: RouteAllocation, ) -> Option<ConsumerRouteReservation>

Source

pub(super) fn release_consumer_setup( &mut self, reservation: &ConsumerRouteReservation, )

Source

pub(super) fn commit( &mut self, reservation: ConsumerRouteReservation, route: TransportConsumerRoute, allocation: RouteAllocation, ) -> bool

Returns whether the route committed.

Source

pub(super) fn update_allocation( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, route: &TransportConsumerRoute, update: impl FnOnce(&mut RouteAllocation), ) -> bool

Source

pub(super) fn update_upgrade( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, route: &TransportConsumerRoute, pending_upgrade: Option<PendingUpgrade>, ) -> bool

Source

pub(super) fn clear_source_upgrades(&mut self, source_id: PublishedSourceId)

Source

pub(super) fn allocation( &self, key: &SubscriptionKey, source_id: PublishedSourceId, ) -> Option<RouteAllocation>

Returns None when the attached source differs from source_id.

Source

pub(super) fn attached( &self, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>

Source

pub(super) fn current( &self, key: &SubscriptionKey, ) -> Option<(&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>

Source

pub(super) fn attached_for_receiver( &self, receiver: &UserId, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>

Source

pub(super) fn attached_for_source( &self, source_id: PublishedSourceId, ) -> impl Iterator<Item = (&'_ SubscriptionKey, SourceSubscriptionIntent, &'_ CurrentPublication)>

Source

pub(super) fn detach_source( &mut self, source_id: PublishedSourceId, ) -> Vec<TransportConsumerRoute>

Source

pub(super) fn reset_receiver_for_replacement(&mut self, receiver: &UserId)

Source

pub(super) fn remove_receiver( &mut self, receiver: &UserId, ) -> Vec<TransportConsumerRoute>

Source

pub(super) fn detach_declined_consumers( &mut self, session: &TransportSessionKey, declined: &[TransportMediaId], ) -> Vec<TransportConsumerRoute>

Source

fn entry(&mut self, key: SubscriptionKey) -> &mut Subscription

Source

fn current_mut( &mut self, key: &SubscriptionKey, source_id: PublishedSourceId, ) -> Option<&mut CurrentPublication>

Source

fn reserved_mut( &mut self, reservation: &ConsumerRouteReservation, ) -> Option<&mut CurrentPublication>

Returns the attachment only while reservation is its pending realization.

Trait Implementations§

Source§

impl Debug for RouteGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

§

impl<T> CryptoSafe for T

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,