Skip to main content

ScanConfig

Struct ScanConfig 

Source
pub struct ScanConfig {
Show 13 fields pub max_depth: Option<usize>, pub batch_size: usize, pub follow_symlinks: bool, pub one_filesystem: bool, pub hidden: Option<Arc<HiddenPolicy>>, pub exclude_special: bool, pub threads: Option<usize>, pub order: ScanOrder, pub types: Option<Arc<TypeRegistry>>, pub read_controls: bool, pub population: IgnoredEntries, pub control_limits: ControlLimits, pub progress: Option<Progress>,
}
Expand description

Knobs for a scan.

Fields§

§max_depth: Option<usize>

Maximum relative entry depth to retain. Zero keeps only the index root and None means unlimited.

§batch_size: usize

Ops per emitted observation. Must be between one and MAX_SCAN_BATCH_SIZE.

§follow_symlinks: bool

Follow symlinks to directories. Off by default: following them turns a tree walk into a graph walk with cycles, and every surveyed tool defaults to off.

§one_filesystem: bool

Stay on the filesystem the root lives on.

§hidden: Option<Arc<HiddenPolicy>>

Hidden-component admission, or None to retain every component.

§exclude_special: bool

Exclude filesystem objects other than files, directories, and symlinks.

§threads: Option<usize>

Directory-reading worker threads.

A tree walk is a pile of independent, latency-bound directory reads, so it scales with threads far better than most work does. One means the serial walker, which stays the reference implementation and the thing every result is checked against, with two exceptions that take the concurrent walker with one worker instead: the detached index build, and a transient summary that reads .gitignore, which must deliver each directory’s control ahead of its entries as that build consumes them. None asks for a bounded default derived from the machine’s available parallelism. The automatic pool starts conservatively and unlocks more latency-hiding workers only when initial chunk timing identifies a slow filesystem path.

This is an operational knob, not a semantic one: it changes how fast the same observations are produced, never which observations they are. That is why it stays out of ScanScope and cannot invalidate a cache.

§order: ScanOrder

The order directories are visited in. See ScanOrder.

§types: Option<Arc<TypeRegistry>>

File-type rules to classify against, or None for the ones compiled into fdu.

Unlike Self::threads this is semantic: a different taxonomy classifies the same tree differently, which is why its fingerprint rides in ScanScope and a change to it invalidates a snapshot. Shared rather than owned because a scan clones its config per wave and a registry is read-only once built.

§read_controls: bool

Observe .gitignore control files and retain ignore classification.

On by default on every surface: an Index from crate::open or a scan keeps the exact control state it exposes and a watch maintains – which entries are ignored, and the ignored and unignored partitions of every roll-up – and a one-shot report from crate::prepare_report shows the ignored share of every row (fdu-elnn). It costs a read of every .gitignore in the tree. A file past the Self::control_limits is refused and named in Index::control_coverage rather than ending the scan; a file that cannot be read is an error at its path, which makes the result partial.

Off, the scan performs no control-file I/O and retains no control table, and that is stamped into ScanScope, so an index-returning call never serves a snapshot taken one way as the other. An Index built that way answers Index::is_ignored, Index::controls, and the partition accessors with crate::Error::ControlStateNotObserved, never with “not ignored”, and refuses control input; a report’s rows carry no ignored share, and a selection by ignored state is refused. The command line spells it --no-gitignore.

An opened root (crate::OpenedIndex) always observes control state, because its ignored and unignored partitions are part of what it serves.

§population: IgnoredEntries

Which ignored population shapes retained entries and content candidates.

§control_limits: ControlLimits

The budget and the line limit .gitignore files are applied under, each a size or unbounded. See crate::control::ControlLimits.

A source that would take the table past the budget, or that has a line longer than the line limit, is refused: its rules do not apply, the scan continues with every size exact, and Index::control_coverage names it and the limit that fired. The command line spells these --gitignore-budget SIZE|all and --gitignore-line-limit SIZE|all; the Python API spells them control_budget and control_line_limit.

Semantic, like Self::read_controls: the limits decide which rules apply, so both are part of ScanScope and a snapshot taken under other limits is not reused. Ignored when control state is not observed.

§progress: Option<Progress>

Where to report how much of the walk has been done, or None to report nothing.

An observer rather than a knob: it changes neither which observations a walk produces nor how it produces them, so it is no part of ScanScope or of any snapshot identity, and two configs that differ only here are the same scan. Honoured by every walker in this module – the cold scans, the summary fold, revalidate, and each reconcile entry point – which enter ProgressPhase::Scanning or ProgressPhase::Revalidating and add their counts once per chunk of directories, never per entry. See crate::Progress for what the counts mean and what holds when a walk returns.

Implementations§

Source§

impl ScanConfig

Source

pub fn with_types(self, types: Arc<TypeRegistry>) -> Self

Classify this scan with types and include their derived identity in its scope.

Source

pub fn types(&self) -> &TypeRegistry

The file-type rules in effect: the supplied registry, or the compiled default.

Source

pub fn hidden(&self) -> &HiddenPolicy

Hidden-component policy in effect.

Source

pub fn scope(&self) -> ScanScope

Semantic cache identity, excluding operational batching choices.

Composed from Self::snapshot_identity, so the scope an index records and the tier identities a snapshot of it carries are one value in two shapes.

No longer const: the type-rule fingerprint is now a property of the registry in effect rather than a compiled-in constant, which is the whole point of letting a caller supply one. A snapshot taken under different rules must not be reused.

Source

pub fn entry_scope(&self) -> EntryScope

Which entries this scan retains, the part of its scope no .gitignore setting changes.

Source

pub fn control_identity(&self) -> ControlTierIdentity

Whether this scan observes .gitignore control state, and under which limits.

The limits are part of the identity only when control state is observed: a scan that reads no control file applies none, whatever Self::control_limits says.

Source

pub fn snapshot_identity(&self) -> SnapshotIdentity

The identity of every tier a snapshot of this scan holds.

Trait Implementations§

Source§

impl Clone for ScanConfig

Source§

fn clone(&self) -> Self

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 ScanConfig

Source§

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

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

impl Default for ScanConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<ScanConfig> for Scope

Source§

fn from(scan: ScanConfig) -> Self

Converts to this type from the input type.

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<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> 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 = !

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.