pub struct Removing { /* private fields */ }Expand description
How far through its batch a running removal is.
A running byte total is the wrong thing on its own, and real use is what showed it: bytes say how much has gone but not how much is left to go, so a reader watching a long delete cannot tell a third of the way through from nearly finished. A count of targets against the batch’s own total can, and this is the one phase of the run where the denominator is honest without qualification — it is fixed the instant the reader answers the confirmation, where the pricing bar’s denominator grows as the walk finds claims faster than the pool can price them.
It is a lower bound, and deliberately so. The deleter speaks only for a target something actually happened to, so a batch where one turned out to be gone already ends at eleven of twelve rather than counting a directory nobody touched. The state ends when the batch reports, not when the count reaches its total.
§…and a count on its own is not enough either, which took a real batch to learn
The paragraph above is right that bytes cannot say how much is left. What it missed is that
a count cannot say how much is left either, because targets are not the same size — and
they are not close. A real pristine ~ batch of 2,188 directories sat at 2,162 of 2,188,
98% for over an hour, because the small ones drain first and the twenty-six still going
were most of the bytes. Every figure on the screen was true and the reader still could not
tell it from a hang.
So there are two, and they answer the two different questions a reader has: percent is
how far through the list, weighed is how much of the weight, and busiest names
the one target that decides when it ends. Neither number is the other’s approximation.
Implementations§
Source§impl Removing
impl Removing
Sourcepub fn percent(&self) -> u8
pub fn percent(&self) -> u8
How far through, for the footer and for the dock.
Targets rather than bytes, and that is not an oversight. A batch that failed on every
one of its targets has still been worked through, and a bar weighted by bytes would read
0% for the whole of it — which reports the outcome under the guise of the position.
What bytes are good for is saying how much is left, and Removing::weighed says that
beside this rather than instead of it.
Sourcepub fn weighed(&self) -> Option<(u64, u64)>
pub fn weighed(&self) -> Option<(u64, u64)>
Bytes given back so far against what the plan expected of the whole batch, or None
when nothing in it was priced and there is no denominator to give.
This is the half of the answer a count cannot give. Targets vary in size by four orders of magnitude, so “2162 of 2188” says nothing about whether the remainder is a second or an hour — and the last few targets of a real batch are routinely most of its bytes.
Sourcepub fn busiest(&self) -> Option<&Path>
pub fn busiest(&self) -> Option<&Path>
The target the batch is most likely to be waiting on: the largest one the pool has started and not yet moved off.
A removal runs its targets concurrently, so there is no single current one — but there is one that decides when the batch ends. A target is swept by a single thread, so once the pool has more threads than targets left the finish time is the largest survivor’s, and that is the name worth drawing. It changes only when that target is done, where naming the most recent report would flicker between unrelated paths several times a second — motion that is not information.
Weighed by what the plan thought each was worth, falling back to what each has already given back when nothing priced them: on an unpriced batch the target that has freed the most is the best available guess at the biggest. The path breaks the remaining ties, so that two equal targets do not swap the name between frames.
Trait Implementations§
impl Eq for Removing
impl StructuralPartialEq for Removing
Auto Trait Implementations§
impl Freeze for Removing
impl RefUnwindSafe for Removing
impl Send for Removing
impl Sync for Removing
impl Unpin for Removing
impl UnsafeUnpin for Removing
impl UnwindSafe for Removing
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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