Skip to main content

Removing

Struct Removing 

Source
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

Source

pub fn counted(&self) -> (usize, usize)

Targets done, and how many there are.

Source

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.

Source

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.

Source

pub fn freed(&self) -> u64

Bytes the batch has given back so far, across every target in it.

Source

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.

Source

pub fn label(&self) -> String

What the footer says: where the deleter is, and how much of the batch’s weight that leaves. The name of what it is working on is drawn beside this rather than folded in, because only the renderer knows how much room is left for a path.

Trait Implementations§

Source§

impl Clone for Removing

Source§

fn clone(&self) -> Removing

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Removing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Removing

Source§

impl PartialEq for Removing

Source§

fn eq(&self, other: &Removing) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Removing

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
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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.