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: usizeOps per emitted observation. Must be between one and MAX_SCAN_BATCH_SIZE.
follow_symlinks: boolFollow 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: boolStay on the filesystem the root lives on.
Hidden-component admission, or None to retain every component.
exclude_special: boolExclude 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: ScanOrderThe 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: boolObserve .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: IgnoredEntriesWhich ignored population shapes retained entries and content candidates.
control_limits: ControlLimitsThe 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
impl ScanConfig
Sourcepub fn with_types(self, types: Arc<TypeRegistry>) -> Self
pub fn with_types(self, types: Arc<TypeRegistry>) -> Self
Classify this scan with types and include their derived identity in its scope.
Sourcepub fn types(&self) -> &TypeRegistry
pub fn types(&self) -> &TypeRegistry
The file-type rules in effect: the supplied registry, or the compiled default.
Hidden-component policy in effect.
Sourcepub fn scope(&self) -> ScanScope
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.
Sourcepub fn entry_scope(&self) -> EntryScope
pub fn entry_scope(&self) -> EntryScope
Which entries this scan retains, the part of its scope no .gitignore setting
changes.
Sourcepub fn control_identity(&self) -> ControlTierIdentity
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.
Sourcepub fn snapshot_identity(&self) -> SnapshotIdentity
pub fn snapshot_identity(&self) -> SnapshotIdentity
The identity of every tier a snapshot of this scan holds.