Module unified_walker

Module unified_walker 

Source
Expand description

Unified filesystem walker — traverses a union of roots once and classifies files into audio/daw/preset/pdf buckets by extension.

§Why

Running 4 separate walkers (audio, daw, preset, pdf) over overlapping roots (~, /Applications, /Volumes/*) re-walks the same directories 4x. On SMB shares, each readdir/stat is a network roundtrip — re-walks cost minutes. This module walks each subtree exactly once.

§How

  1. Union the per-type root sets.
  2. Walk each unique root in parallel via rayon, dedup-visited by canonical path.
  3. For every file entry, classify by lowercase extension against each type’s extension set AND the type’s root-membership predicate. A file at ~/foo.wav is audio if ~/foo.wav sits under at least one audio_roots entry (for typical setups, this is trivially true).
  4. DAW packages (.logicx, .band directories) are detected at directory level and treated as projects; their subtree is NOT descended.
  5. Plugin bundles (.vst3, .component, etc.) are skipped entirely for DAW, but their interiors ARE still walked for audio/preset/pdf content.
  6. Symlinks: readdir does not mark symlink targets as files/dirs; each symlink is stated and classified by its target (broken symlinks skipped).

Per-type progress callbacks stream batches as they’re discovered.

Structs§

IncrementalDirState
Snapshot + in-scan updates for incremental directory skipping (scan_unified and standalone per-type walkers). Persisted in SQLite under domain "unified" so all scan modes share one mtime map.
UnifiedCounts
Running totals across all types.
UnifiedSpec
Per-type scanning configuration. Empty roots disables the type (no output).

Enums§

ClassifiedBatch
One classified batch sent to the on_batch callback.

Constants§

DAW_BACKUP_DIRS 🔒
DAW_EXTENSIONS 🔒
DAW_PACKAGE_EXTENSIONS 🔒
DAW_PLUGIN_BUNDLE_EXTENSIONS 🔒
PDF_EXTENSION 🔒
PRESET_EXTENSIONS 🔒

Functions§

daw_name_for_format 🔒
dir_mtime_secs 🔒
directory_incremental_key 🔒
Same path key string as visit deduplication: canonicalize when possible, else normalized original.
ext_match 🔒
Does the lowercased filename end with any of exts? exts must include the leading dot.
fmt_mtime_ymd 🔒
Format a UNIX timestamp (seconds since epoch) as “YYYY-MM-DD” in UTC. Returns empty string for invalid/zero timestamps.
format_size 🔒
get_directory_size 🔒
get_directory_size_depth 🔒
is_network_path 🔒
Quick check: is this path likely on a network share? Network mounts can be anywhere (not just /Volumes/ or /mnt/), so fall back to statfs(2) which is authoritative on macOS.
is_valid_band_package 🔒
network_fs_type 🔒
normalize_macos_path 🔒
under_any_root 🔒
Membership predicate — does path live under any root in roots? Empty roots list means “no files qualify for this type”.
walk_dir_parallel 🔒
walk_unified
Walk the union of all roots across types, emitting classified batches.