pub struct ReconnectCoordinator { /* private fields */ }Expand description
Coordinates subscription reconnects across a parallel batch sharing one bandwidth-constrained link.
A dropped subscription competing with its still-streaming siblings just
starves — the handshake can’t get through a saturated pipe. So once a session
has burned its fast ungated attempts, it stops fighting and parks until no
sibling is streaming (the connected sessions have finished and freed their
bandwidth), then reconnects into the quiet link and resumes via
replayFromSlot. Stepping aside also speeds the streaming siblings up, so the
batch drains and the parked sessions recover — serially, one at a time, since
at a tight rate only one stream fits.
Implementations§
Source§impl ReconnectCoordinator
impl ReconnectCoordinator
pub fn new() -> Self
Sourcepub fn enter(self: &Arc<Self>) -> StreamingGuard
pub fn enter(self: &Arc<Self>) -> StreamingGuard
Mark this subscription as streaming until the returned guard drops.
Call once a (re)subscribe succeeds; the guard’s Drop decrements the
count and wakes any sibling parked in Self::reconnect_slot. RAII so
a panicking or aborted task can’t leak the count and wedge the batch.
Sourcepub async fn reconnect_slot(
&self,
cancel: &CancellationToken,
) -> Option<OwnedSemaphorePermit>
pub async fn reconnect_slot( &self, cancel: &CancellationToken, ) -> Option<OwnedSemaphorePermit>
Park until no sibling is streaming, then take the single reconnect slot.
The returned permit must be held across connect + subscribe and dropped
once Self::enter has been called (or the attempt failed), so the next
parked session proceeds only after this one is streaming again. Returns
None if cancelled.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReconnectCoordinator
impl !RefUnwindSafe for ReconnectCoordinator
impl !UnwindSafe for ReconnectCoordinator
impl Send for ReconnectCoordinator
impl Sync for ReconnectCoordinator
impl Unpin for ReconnectCoordinator
impl UnsafeUnpin for ReconnectCoordinator
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
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>
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>
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