pub struct ObserverLease { /* private fields */ }Expand description
RAII observer handle on a FillSession. One is minted for the pull owner and
one per attached serve leg (FillRegistry::claim). Releasing it decrements the
session’s observer count; the last-out release, if the pull is still running,
cancels the pull so a fill no client is waiting on stops ingesting (#1610) — and
hands back the session’s parked pull-thread handle so THAT caller joins it
off-task (the owner-join hand-off: whoever leaves LAST joins the pull, freeing an
owner whose own client finished first).
The decrement + cancel decision runs UNDER the registry map lock — the same
lock claim/register_fill hold when they attach an observer. That mutual
exclusion closes the resurrection race: a concurrent claim cannot fetch_add a
session 0→1 in the window between this drop’s last-out fetch_sub (1→0) and its
cancel(), so no live observer can end up bound to a cancelled fill. The lease
therefore holds a Weak back to the registry (plus the session’s hash) to
reach that lock at drop. If the upgrade fails the registry is gone, so the fill
is moot and the drop just skips. It only TAKES the pull handle under the lock;
the JOIN always runs off it.
Implementations§
Source§impl ObserverLease
impl ObserverLease
Sourcepub fn release(self) -> Option<JoinHandle<()>>
pub fn release(self) -> Option<JoinHandle<()>>
Release the lease at a serve leg’s teardown, handing back the parked
pull-thread handle when THIS release is the last one out. The caller joins that
handle OFF the registry map lock and off its accept task (on a blocking
thread). A non-last-out release returns None, so an owner whose own client
finished first returns at once, leaving the pull filling for the remaining
observers — the last of which cancels it (#1610 preserved). Named so teardown
reads as intent rather than an incidental drop.
Trait Implementations§
Source§impl Debug for ObserverLease
impl Debug for ObserverLease
Source§impl Drop for ObserverLease
impl Drop for ObserverLease
Auto Trait Implementations§
impl Freeze for ObserverLease
impl RefUnwindSafe for ObserverLease
impl Send for ObserverLease
impl Sync for ObserverLease
impl Unpin for ObserverLease
impl UnsafeUnpin for ObserverLease
impl UnwindSafe for ObserverLease
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
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