pub struct Moving { /* private fields */ }Expand description
Everything the view is in the middle of showing.
Implementations§
Source§impl Moving
impl Moving
Sourcepub fn tick(&mut self, now: Instant)
pub fn tick(&mut self, now: Instant)
Moves the clock on, before anything asks a question whose answer depends on it.
Split out from Moving::advance because the caller has work to do between the two
— working out what each row is worth given what is draining away under it, which is a
question about this frame’s instant and not the last one’s.
Sourcepub fn advance(
&mut self,
now: Instant,
rows: &[(NodeId, u64, bool)],
freed: u64,
)
pub fn advance( &mut self, now: Instant, rows: &[(NodeId, u64, bool)], freed: u64, )
Advances every drawn row toward what it is really worth, and forgets the rest.
rows is the viewport’s worth of (row, what it is worth now, is that exact), so a row
that scrolled off loses its state and a row that scrolls back on starts at the truth.
That is the whole of the cost story: this is O(rows on screen), never O(tree).
Exact means the caller is already interpolating that value itself and the chase must not add a second, slower opinion on top — which is what a row emptying is. Jammed rather than skipped, so that when the drain ends the chase carries on from where the ramp left off instead of from wherever it was standing when the drain began.
Sourcepub fn shown(&self, id: NodeId, truth: u64) -> u64
pub fn shown(&self, id: NodeId, truth: u64) -> u64
What a row draws, which is the truth once it has caught up with it.
Sourcepub fn arrived(&mut self, id: NodeId, now: Instant)
pub fn arrived(&mut self, id: NodeId, now: Instant)
Notes a directory that has just appeared in the tree.
Sourcepub fn freshness(&self, id: NodeId) -> f64
pub fn freshness(&self, id: NodeId) -> f64
How lit a newly arrived row is: 1.0 the moment it lands, 0.0 once it is old news.
Sourcepub fn cascade(&mut self, ancestors: &[NodeId], now: Instant)
pub fn cascade(&mut self, ancestors: &[NodeId], now: Instant)
Lights a mark running outwards through ancestors, nearest first.
Sourcepub fn is_cascading(&self, id: NodeId) -> bool
pub fn is_cascading(&self, id: NodeId) -> bool
Whether this row’s rung of the cascade is lit at this instant.
A rung that has not come round yet is not lit either, which is what makes the mark travel rather than all of it flashing at once.
Sourcepub fn cools(&mut self, id: NodeId)
pub fn cools(&mut self, id: NodeId)
Notes that it has come back out, with a price or without one.
Sourcepub fn cooled(&mut self)
pub fn cooled(&mut self)
Forgets every claim that was being priced, for the end of the walk: a pool that has stopped leaves nothing hot behind, and a row shimmering for a thread that no longer exists would be the one moving thing here that says nothing.
Sourcepub fn is_hot(&self, id: NodeId) -> bool
pub fn is_hot(&self, id: NodeId) -> bool
Whether a pricing thread is inside this claim right now.
Sourcepub fn hot(&self) -> impl Iterator<Item = NodeId> + '_
pub fn hot(&self) -> impl Iterator<Item = NodeId> + '_
Every claim currently being priced, so the view can drop the ones that have since gone.
Sourcepub fn shimmer(&self, width: usize, epoch: Instant) -> usize
pub fn shimmer(&self, width: usize, epoch: Instant) -> usize
Which cell of a width-wide shimmer is lit.
One phase for the whole screen rather than one per row: the reader is being told how many rows are hot, and rows that pulse together are countable at a glance where rows each doing their own thing are not.
Sourcepub fn frees(&mut self, id: NodeId, bytes: u64)
pub fn frees(&mut self, id: NodeId, bytes: u64)
Records how much of a target the deleter says has gone so far.
Taken as the total rather than added to, because that is what the event carries: a report that arrives out of order behind a later one is discarded rather than winding the row backwards, which the pool makes possible and nothing else would catch.
Sourcepub fn spends(&mut self, id: NodeId, bytes: u64, now: Instant)
pub fn spends(&mut self, id: NodeId, bytes: u64, now: Instant)
Records that the deleter has finished with a target, and starts its dimmed beat.
Sourcepub fn is_freeing(&self, id: NodeId) -> bool
pub fn is_freeing(&self, id: NodeId) -> bool
Whether bytes are leaving this target right now.
Sourcepub fn is_spent(&self, id: NodeId) -> bool
pub fn is_spent(&self, id: NodeId) -> bool
Whether this row has emptied and is spending its last moment on screen.
Sourcepub fn is_leaving(&self, id: NodeId) -> bool
pub fn is_leaving(&self, id: NodeId) -> bool
Whether the deleter has touched this row at all — either phase.
The one predicate the batch, the marks and space all read, so “a directory the
deleter is part way through is not a directory to delete again” is stated once rather
than in the three places that could drift.
Sourcepub fn leaving(&self) -> impl Iterator<Item = (NodeId, u64)> + '_
pub fn leaving(&self) -> impl Iterator<Item = (NodeId, u64)> + '_
Every row the running removal is still on screen for, with the bytes it has given back so far.
What every ancestor subtracts, and half of what the freed counter adds up. Spent targets are in here too until their row collapses, because their bytes are just as gone and the rows above them have to say so.
Sourcepub fn freed_from(&self, id: NodeId) -> u64
pub fn freed_from(&self, id: NodeId) -> u64
What the deleter has given back from this row so far.
Sourcepub fn freed_so_far(&self) -> u64
pub fn freed_so_far(&self) -> u64
What the running batch has given back in total, rows still on screen and rows already collapsed alike.
Sourcepub fn collapsed(&mut self, now: Instant) -> Vec<NodeId> ⓘ
pub fn collapsed(&mut self, now: Instant) -> Vec<NodeId> ⓘ
The rows whose dimmed beat is over, which the view then takes out of the tree for real. Forgotten here in the same breath, so each is handed over exactly once.
Sourcepub fn banked(&mut self)
pub fn banked(&mut self)
Hands the running total over to the caller’s own, when the batch has reported one.
The per-target figures and the crate::delete::Removal are the same arithmetic from
the same accounting, so keeping both would count every byte twice. The dimmed rows stay
where they are: what they are worth on screen is zero either way, and it is the tree
that still has to lose them.
Everything dropped here is transient, which is a constraint on the caller as much as
a description. A target the sweep finished with is on its way out of the tree anyway;
a target it could not finish is staying, and the only record that it is smaller than
it was is the figure about to be cleared. So an incomplete target’s reduction has to be
made durable before this runs, or its row and every total above it spring back to what
they were worth before the deletion — see super::state::View::deleted, which is the
one caller, and crate::tree::Tree::shrink, which is where the bytes go.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Moving
impl RefUnwindSafe for Moving
impl Send for Moving
impl Sync for Moving
impl Unpin for Moving
impl UnsafeUnpin for Moving
impl UnwindSafe for Moving
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> 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