Skip to main content

HeldSeats

Struct HeldSeats 

Source
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

Source

fn lock(&self) -> MutexGuard<'_, HashMap<SessionSlot, Held>>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn take_pr_stale(&self, slot: &SessionSlot) -> bool

Whether a nudge asked for a PR lookup, clearing the mark.

Source

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.

Source

fn take_tree_moved(&self, slot: &SessionSlot) -> bool

Whether a test reported the tree moved, clearing the mark.

Source

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.

Source

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§

Source§

impl Default for HeldSeats

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,

§

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

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
§

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