pub struct Measurer { /* private fields */ }Expand description
Measures directories under a fixed policy.
Implementations§
Source§impl Measurer
impl Measurer
Sourcepub fn same_file_system(self, same_file_system: bool) -> Self
pub fn same_file_system(self, same_file_system: bool) -> Self
Whether to descend across a mount point. Off by default, matching the safety model: what the deleter will not cross, the measurer must not count.
Sourcepub fn traverses(&self, dir: &Path, metadata: &Metadata) -> bool
pub fn traverses(&self, dir: &Path, metadata: &Metadata) -> bool
Whether measuring dir means traversing it.
This is what decides whether a claim goes to the pricing pool instead of being sized on
the walker thread that found it. Two things are false here and both matter: a claim
this mode does not price at all, and a symlink, whose one lstat the walk has
already done. Queueing either would trade a constant-time answer for a thread handoff
and delay the claim’s own publication for nothing.
Sourcepub fn measure(&self, dir: &Path, metadata: &Metadata) -> Measurement
pub fn measure(&self, dir: &Path, metadata: &Metadata) -> Measurement
Measures dir, whose metadata the caller already has from the walk.
Returns without touching the filesystem under SizeMode::Skip, which is the point.
Sourcepub fn survey(&self, dir: &Path, metadata: &Metadata) -> Survey
pub fn survey(&self, dir: &Path, metadata: &Metadata) -> Survey
One pass over a tier-two candidate, answering both questions the tier has left: how big it is, and whether it holds a git repository.
This walks whatever the mode is, because neither answer can be inferred, and it walks
the whole subtree. An earlier version stopped as soon as it had enough bytes to clear
the floor, which is much cheaper — and useless here, because “holds no repository” is a
negative and a negative is only proved by covering everything. The consolation is that
this pass is still cheaper than what the walker would have done had tier two not
claimed the directory at all: a tight read_dir + lstat loop with no ignore stack and
no rule evaluation, and then a prune.
Because it always covers everything, a tier-two claim arrives with a real size even on a
default scan. Tier one’s claims stay Size::Unmeasured: nothing forces the walk to
look inside those.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Measurer
impl RefUnwindSafe for Measurer
impl Send for Measurer
impl Sync for Measurer
impl Unpin for Measurer
impl UnsafeUnpin for Measurer
impl UnwindSafe for Measurer
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<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