pub(crate) struct HeldSeats {
held: Mutex<HashMap<SessionSlot, Held>>,
gates: Mutex<HashMap<SessionSlot, Weak<Mutex<()>>>>,
}Expand description
The seats a view is showing, and the loop each one runs.
Fields§
§held: Mutex<HashMap<SessionSlot, Held>>§gates: Mutex<HashMap<SessionSlot, Weak<Mutex<()>>>>The gate a seat’s reads share, by weak reference, so it outlives the hold exactly as long as a read still holds it. A re-hold during such a read upgrades this and shares the gate; once the read lets go the weak dies and the next hold starts a fresh one. Dead entries are pruned on the next look.
Implementations§
Source§impl HeldSeats
impl HeldSeats
fn lock(&self) -> MutexGuard<'_, HashMap<SessionSlot, Held>>
Sourcefn gate_arc(&self, slot: &SessionSlot) -> Arc<Mutex<()>> ⓘ
fn gate_arc(&self, slot: &SessionSlot) -> Arc<Mutex<()>> ⓘ
The gate for a seat’s first hold: the one a read still holds, or a new one, remembered weakly for the next re-hold.
Sourcefn acquire(&self, slot: &SessionSlot) -> Taken
fn acquire(&self, slot: &SessionSlot) -> Taken
Take a hold on slot, answering the mark the record’s read fires and
the sender that stops the seat’s loop when this is the first hold.
Sourcefn gate(&self, slot: &SessionSlot) -> Option<Arc<Mutex<()>>>
fn gate(&self, slot: &SessionSlot) -> Option<Arc<Mutex<()>>>
The seat’s read gate, when one is there: a held seat’s, or one a read still holds after its hold went. A seat neither held nor read has no loop to race, so the caller reads unguarded rather than waiting.
Sourcefn note_record_read(&self, slot: &SessionSlot)
fn note_record_read(&self, slot: &SessionSlot)
Say the record’s first read is done, which is the mark the watch’s
first pass waits on. notify_one holds the permit for a watch that has
not reached its wait yet, so the mark cannot be missed.
Sourcefn nudge(&self, slot: &SessionSlot, pr_stale: bool)
fn nudge(&self, slot: &SessionSlot, pr_stale: bool)
Wake the seat’s loop because the session reported a repository mutation, marking the PR block stale too when the report was a published change. A seat nobody holds has no loop to wake.
Sourcefn take_pr_stale(&self, slot: &SessionSlot) -> bool
fn take_pr_stale(&self, slot: &SessionSlot) -> bool
Whether a nudge asked for a PR lookup, clearing the mark.
Sourcepub(crate) fn mark_tree_moved(&self, slot: &SessionSlot)
pub(crate) fn mark_tree_moved(&self, slot: &SessionSlot)
Report the tree moved, as the file watch does, for a test that drives a pass rather than racing the OS daemon’s delivery.
Sourcefn take_tree_moved(&self, slot: &SessionSlot) -> bool
fn take_tree_moved(&self, slot: &SessionSlot) -> bool
Whether a test reported the tree moved, clearing the mark.
Sourcepub(crate) fn pass_done(&self, slot: &SessionSlot) -> Option<Arc<Notify>>
pub(crate) fn pass_done(&self, slot: &SessionSlot) -> Option<Arc<Notify>>
The mark a held seat’s loop raises at the end of every pass.
Sourcefn release(&self, slot: &SessionSlot)
fn release(&self, slot: &SessionSlot)
Give a hold back. The last hold stops the loop and drops the entry; a
read still in flight keeps its gate alive through Self::gates, so
a re-hold before it finishes shares it rather than racing a second.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HeldSeats
impl RefUnwindSafe for HeldSeats
impl Send for HeldSeats
impl Sync for HeldSeats
impl Unpin for HeldSeats
impl UnsafeUnpin for HeldSeats
impl UnwindSafe for HeldSeats
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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