Skip to main content

UpdateFanout

Struct UpdateFanout 

Source
pub(crate) struct UpdateFanout {
    shared: Arc<Mutex<Shared>>,
}
Expand description

Cloneable sender half of the workspace’s fan-out to its subscribers.

Every clone shares one registry. Self::send hands the update to each subscriber and drops any whose receiver has gone, so the registry never keeps a dead one.

Fields§

§shared: Arc<Mutex<Shared>>

Implementations§

Source§

impl UpdateFanout

Source

pub(crate) fn subscribe( &self, role: SubscriberRole, ) -> UnboundedReceiver<SeatUpdate>

Mint a subscriber stream, declaring what the caller can do with it. A stream carries what is emitted after this call and nothing before it; a subscriber reads what it missed from the subject’s snapshot instead.

Source

pub(crate) fn send(&self, update: SessionUpdate) -> bool

Deliver update to every subscriber, and report whether one took it. false is the “no receiver” signal the single-take channel gave, which spawn::try_emit and SessionTask::emit log on.

One update, one pointer. The frame is wrapped once and each subscriber is handed an Arc clone, so the fan-out never pays a payload copy however many subscribers there are. The last subscriber is taken out of the registry to receive it directly and goes back only if it took it, which is also where a dead one leaves.

Source

pub(crate) fn next_seq(&self, slot: &SessionSlot) -> u64

The number slot’s next frame will be minted under.

The read behind a seat’s reconnect answer: the occupant names the epoch and this names where its stream stands, so a client that has just read the seat knows exactly what to expect next.

Source

pub(crate) fn frames_between( &self, slot: &SessionSlot, from: u64, to: u64, ) -> Vec<SeatUpdate>

The frames of slot’s window numbered in from..=to, oldest first, for a client that read a gap in them.

Source

pub(crate) fn oldest_kept(&self, slot: &SessionSlot) -> Option<u64>

The oldest number slot’s window still holds: what tells a range it can answer from memory from one it cannot.

Source

pub(crate) fn unringed_between( &self, slot: &SessionSlot, from: u64, to: u64, ) -> u64

How many numbers in from..=to on slot’s stream no window can hold.

Source

pub(crate) fn epoch_opened_with_rows(&self, slot: &SessionSlot) -> bool

Whether slot’s latest epoch-opening seal carried rows, which no ring holds.

Source

pub(crate) fn set_ring_cap(&self, cap: usize)

Drive the ring’s cap down, so a test reaches the transcript fallback without emitting a window’s worth of frames.

Source

pub(crate) fn count(&self) -> usize

How many subscribers are attached.

A test uses this to tell one subscription from another. “Did anyone receive” cannot: a listener that is always there - the socket’s own fold - makes every emit land, however many views have come and gone.

Source

pub(crate) fn answering_count(&self) -> usize

How many subscribers could answer a prompt. Test-only: the role decides whether the core parks a turn on a subscriber’s reply, and nothing else reports it.

Source

pub(crate) fn send_answering(&self, update: SessionUpdate) -> bool

Deliver update to every subscriber, and report whether one that can ANSWER it took it. A path that parks a turn on an answer uses this rather than Self::send: an observer takes the update and never replies, so counting it would leave the turn waiting on a response nobody will send.

An update emitted before anything attached reaches nobody: a subscriber takes what follows its own subscribe. So a caller must fail its turn closed on a false return; one that parked the turn anyway belongs on Self::send.

Source

fn deliver( &self, update: SessionUpdate, required: Option<SubscriberRole>, ) -> bool

Trait Implementations§

Source§

impl Clone for UpdateFanout

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for UpdateFanout

Source§

fn default() -> Self

Returns the “default value” for a type. 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
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

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
§

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,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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
§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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