Track B // Deep Engineering Reference
Developer & Architecture Docs
Complete technical breakdown of every subsystem across crates/fast-core, src-tauri, and src/—from memory layout and scheduling invariants to IPC contracts, EWLS transfer modeling, and headless CI verification.
1. Three-Layer Decoupled Architecture & Core Invariants
FAST File Explorer strictly isolates pure-Rust filesystem and algorithmic logic from the Tauri 2 native host and the React 19 webview UI:
┌─────────────────────────────────────────────────────────────────────────┐
│ src/ React 19 + TypeScript 7 + Zustand 5 + Vite 8 │
│ Virtualization (@tanstack/react-virtual), pointer DnD │
├──────────────────── invoke() commands ▲ ▼ Tauri events ─────────────────┤
│ src-tauri/ Tauri 2 Shell: AppState, WorkerPools, IPC handlers, │
│ native clipboard/drag-out, tray, detached windows │
├─────────────────────────────────────────────────────────────────────────┤
│ crates/fast-core/ 56 Pure-Rust modules: listing, 40B SIMD index, cache,│
│ transfers, archives, remote, MTP, treemap, locks │
│ (ZERO dependency on Tauri, WebView, or UI) │
└─────────────────────────────────────────────────────────────────────────┘1. Zero Disk I/O on UI Thread
Every Tauri command touching disk or network delegates to tokio::task::spawn_blocking or dedicated pools. Long jobs stream progress via events.
2. Answer From Memory, Verify After
Cached folder listings and saved drive lists paint immediately at launch/navigation; background re-reads emit dir-updated only on diff.
3. Render & Decode Only Viewport
Lists virtualize via @tanstack/react-virtual. Thumbnails and column_values wait for scroll settle so fast scrolling queues zero wasted I/O.
4. Unprivileged-First Elevation
Main process never runs elevated. Permission failures trigger elevated_start, spawning fast-file-explorer --job <file> via UAC / polkit / osascript.
2. Complete crates/fast-core Module Map (56 Modules)
Every capability lives in crates/fast-core/src/ so engine behavior can be benchmarked and unit-tested independently of Tauri:
entry.rsDirectory listing (parallel stat metadata for large folders), create, rename, and delete.foldercache.rsTwo-tier listing cache: fast RAM LRU backed by Tier-2 bincode files in cache/listings/.index.rsCompact 40-byte depth-first node arena + contiguous lowercase name buffer for SIMD memmem search.indexset.rsMulti-root parallel scanner managing per-volume indexes and incremental watch updates.search.rsQuery parser (ext:, type:, size:, wildcards), SIMD substring pass, filtering, and ranking.sizecache.rsPersistent folder size & item-count cache feeding Details pane and folder columns.watch.rsNon-recursive open-folder watcher using notify (200ms quiet merge, 2s max, 48-folder cap).predict.rsMarkov-style transition model learning which folders you open next for predictive prefetching.fill.rsFast folder-fill inspector (empty / onlyFolders / files) up to 96 folders per batch.transfer/engine.rsMulti-lane worker engine: earlyStartMs streaming, lazy_dirs, Linux copy_file_range, conflict ask gate.transfer/strategy.rsChooses rename, CoW clone (APFS/Btrfs/XFS/ReFS), small/large lanes, HDD 2+1 cap, or net 16+2.transfer/method.rsNetMap mount detection + Robocopy (/COMPRESS), rsync (--out-format), and rclone JSON stderr parser.transfer/eta.rsEWLS regression (time = a + b * size) with confidence staging (Rough -> Getting accurate -> Settled).transfer/probe.rsBounded 1.5s drive probe (8 MiB read/write + 24 tiny files) in .fast-probe-* when history is absent.transfer/throttle.rsPer-job and global token-bucket bandwidth pacing (KB/s) + time-limit pause/stop enforcement.transfer/careful.rsSafe atomic write-to-temp & verify primitives for sensitive operations.history.rsPersisted transfer telemetry (45-day half-life, 2.2 route distance, 10% switch margin, stable codes 0..5).archive.rsPure-Rust ZIP creation and ZIP/TAR/TAR.GZ extraction with safe_relative traversal & symlink guards.browse.rsVirtual archive://file!/inside browsing, central-directory vs local-header zip-cloaking check, 7z/bsdtar bridge.edit.rsIn-place archive mutation (add, move, rename, delete, mkdir) via atomic temp rewrite and swap.thumbs.rsBucketed disk thumbnail cache (64/128/256/512), EXIF orientation, Explorer/QuickLook/ffmpeg/pdftoppm.sniff.rsMagic-byte content sniffer disambiguating .ts, .mod, .key, .pub, .db and detecting text/encoding.columns.rs / columns_extra.rs140+ lazy metadata extractors: permissions, SHA-256/MD5/CRC32, Office/PDF, PE/ELF/Mach-O, EXIF, audio tags.filetools.rsSide-by-side diff, folder/archive sync, SHA-256 duplicates, split/combine (.crc), UUE/XXE/MIME, image convert, grep.remote/mod.rsUnified Session trait + protocol-independent tree helpers (download_tree_as, upload_tree_as, measure_tree).remote/sftp.rsPure-Rust SSH/SFTP via russh + russh-sftp on dedicated single-thread tokio runtime with TOFU known_hosts.remote/ftp.rssuppaftp MLSD/LIST client with .fastpart partial-download resume.remote/webdav.rs / http.rsCustom HTTP/1.1 + rustls + quick-xml WebDAV client supporting PROPFIND, MKCOL, MOVE, DELETE.remote/mtp.rs & devices.rsDirect mtp://<key>/<storage>/<path> phone/camera sessions via mtp-rs + Windows/macOS/GVFS discovery.remote/proxy.rsSOCKS4, SOCKS5 (with auth), and HTTP CONNECT proxy routing for FTP and SFTP.share.rs128-bit getrandom token LAN HTTP file server (max 8 conns) + cloudflared HTTPS quick tunnel wrapper.terminal/Detached background PTY host (host.rs, attach.rs, popout.rs, proto.rs) surviving main window exit.tasks.rsCron, interval, startup, folder-quiet, and drive-arrival job runner with missed-run catchup & stats.locks.rs & access.rsArgon2id passcode folder/drive privacy locks + pre-flight permission checker for UAC/polkit/osascript.treemap.rs & usage.rsWinDirStat nested layout tree + snapshot persistence + live drive I/O throughput.smartclear.rs11-category cleanup scanner (temp, caches, trash, old build folders, SHA-256 dupes) with safety exclusions.pools.rs & resources.rsIsolated WorkerPools (active_io, background_io, thumb_fast, thumb_bg) + 30s Budget evaluator.crashlog.rs & activity.rs250-event ring buffer, panic/SEH hooks, 15s UI freeze watchdog, and PII-scrubbed crash reports.sysreport.rs & telemetry.rsOff-thread hardware/SMART collector (CIM, /sys, diskutil, smartctl) and live per-cell cache metrics.3. Isolated WorkerPools & 12-Tier Budget
Instead of sharing one global Rayon or Tokio blocking pool where heavy indexing or video thumbnailing can starve directory navigation, pools.rs partitions execution across four isolated pools:
active_io— Interactive folder listings, details, rename/create, and user-initiated file opens.background_io— Volume indexing, predictive prefetching, folder-size scans, and cache persistence.thumb_fast— Center-of-viewport-first image decoding (thumbThreads + 1in flight, 16 ms pacing).thumb_bg— Background prewarming of video frames (ffmpeg/Explorer/QuickLook) and PDF pages (pdftoppm).
resources::compute(settings, snapshot) re-evaluates every 30 seconds (and on battery/minimize transitions, emitting budget-changed). Desktop offers 12 presets from Barebones to God-like (plus 6 ultra-light mobile presets: Essential, Light, Balanced, Smooth, Fast, Maximum). Any individual setting can be pinned via lockedKeys or renderingLocked:
| Preset | Threads | RAM Cache | Thumb px | Overscan | CPU / RAM Cap | Indexing & GPU |
|---|---|---|---|---|---|---|
| Barebones | 1 | 8 MB | Off (48px) | 2 | 5% / 1% | Off • Software, No HW Accel |
| Feather | 1 | 16 MB | Off (48px) | 3 | 10% / 2% | Off • HW Accel, No GPU Raster |
| Reduced | 2 | 48 MB | 64px | 4 | 20% / 4% | Off • GPU Raster, VSync |
| Acceptable | 2 | 128 MB | 64px | 6 | 35% / 8% | Home folder • GPU Raster, VSync |
| Average | 4 | 256 MB | 96px | 8 | 50% / 10% | Home + Prefetch • GPU Raster + Zero-Copy |
| Satisfactory | 4 | 384 MB | 96px | 10 | 50% / 12% | Home + Prefetch • GPU Raster + Zero-Copy |
| Decent | 6 | 512 MB | 128px | 12 | 60% / 15% | All local drives • GPU Raster + Zero-Copy |
| Performance | 8 | 1024 MB | 128px | 16 | 70% / 20% | All drives + Prewarm • Zero-Copy + Auto Prio |
| Power | 12 | 2048 MB | 160px | 20 | 80% / 25% | All + Gallery Prewarm • High Prio + Sharp Thumbs |
| Excelling | 16 | 3072 MB | 192px | 30 | 85% / 30% | Aggressive • High Prio + 15ms Poll |
| Exceptional | 24 | 4096 MB | 224px | 48 | 90% / 40% | Full-folder pre-decode • VSync Off + Uncapped Image |
| God-like | All cores (0) | Uncapped (0) | 256px | 80 | Uncapped / Uncapped | Max Speed + 0ms Delay • VSync Off + High OS Prio |
4. Two-Tier Caching & 40-Byte Depth-First SIMD Search Index
FAST File Explorer avoids SQLite overhead for hot-path file lookups by using custom compact binary structures in index.rs and foldercache.rs:
- 40-Byte Depth-First Node Arena: Nodes are stored parent-before-child in a flat
Vec<Node>. Because every subtree occupies a contiguous range of node IDs,subtree_sizescomputes folder totals across the entire drive in a single linear reverse pass. - Contiguous Lowercase Name Arena + SIMD Scan: All filenames sit in one packed lowercase byte buffer. Queries execute a single SIMD
memmempass over the arena, then binary-search node byte-offsets to map hits back to paths, applyext:/type:/size:filters, and rank results. - Benchmark Baseline (2-core VM): 100,000 files scanned in ~0.13 s, searched in 3–5 ms, held in ~7 MB RAM. Saved to disk so search is instant immediately on cold launch while background verification runs.
- Two-Tier Folder Cache: Tier-1 RAM LRU backed by Tier-2 bincode files under
cache/listings/, governed by per-path opt-out exclusions (cachepolicy.rs) and monitored live in Settings → Storage viacache_usage.
5. Adaptive Transfer Engine, Strategy Selection & EWLS ETA Model
Every copy, move, or delete follows a 7-stage pipeline: Spec → Scan → Plan → Method → Estimate → Run → Finish.
// Plan selection based on route, media type, and file-size distribution:
// 1. Same-volume move -> instant OS rename (0 bytes copied)
// 2. Same-volume copy -> CoW clone first (APFS clonefile, Btrfs/XFS FICLONE, ReFS)
// 3. Mostly large files -> narrow stream count, chunked overlapped I/O (copy_file_range on Linux)
// 4. Many small files -> wide parallel worker lane; each file = one fast-path call
// 5. Mixed job -> dedicated small-file lane + large-file lane (large workers join small once drained)
// 6. Spinning HDD route -> capped at <=2 small workers, 1 large stream + turn-based queue serialization
// 7. Network share route -> up to 16 small workers, 2 large streams, 1 MB buffersEarly Start (earlyStartMs = 500) & Conflict Gate
phase1 streams Found messages (Tops, 512-item Items batches, Dirs, Done). If scanning exceeds 500 ms and at least one file is known, go_early begins copying immediately with lazy_dirs creating parent directories on demand while Progress::counting = true. When Conflict::Ask hits a duplicate, Shared::resolve locks the single ask_gate so only one dialog prompts at a time while non-clashing workers continue at full speed.
History-Learned External Method Delegation & EWLS ETA
Stable method codes (0 Built-in, 1 Robocopy, 2 rsync, 3 rclone, 4 SMB-tuned, 5 NFS-tuned) are evaluated by History::choose_method using route/shape distance (< 2.2), 45-day exponential decay, at least 2 trusted samples, and a 10% hysteresis threshold before beating the built-in engine. Time remaining fits time = a + b × size via exponentially weighted least squares:
remaining = (files_left * a + bytes_left * b) / active_workers
Head start priors (EtaTracker::with_head_start):
1. Same-route history (History::predict) -> confidence 0.70 .. 0.90
2. Speed probe (probe.rs: 8 MiB R/W + 24 files) -> confidence 0.45 (runs if >=48 MiB or >=300 files & >10s est)
3. Per-device static priors -> confidence < 0.30
Live takeover after >=3 samples spanning >=0.8s (5s confidence window).6. Complete Tauri 2 IPC Command & Event Reference
Frontend calls in src/api.ts invoke Rust handlers registered in src-tauri/src/commands.rs with camelCase payloads:
| Rust Command | TS Wrapper | Arguments | Returns | Behavior |
|---|---|---|---|---|
| list_dir | listDir | path: String, ticket?: u64 | Listing | Returns cached listing immediately, streams dir-chunk events, verifies in background (dir-updated). |
| record_visit | recordVisit | from: Option<String>, to: String | Vec<String> | Records navigation transition and warms predicted next folders. |
| search | search | query: String, scope?: String, id: u64 | SearchResponse | Immediate SIMD index hits + streaming search-hits events for unindexed/live roots. |
| column_values | columnValues | dir: String, names: Vec<String>, keys: Vec<String> | Vec<ColumnRow> | Lazy viewport-only extraction for 140+ disk/content/media/checksum columns. |
| folder_sizes_start | folderSizesStart | dir: String, names: Vec<String>, refresh: bool | () | Background subfolder sizing emitting folder-size events; cancels on navigation. |
| thumbnail | thumbnail | path: String, size: u32 | tauri::ipc::Response | Decoded binary image bytes; supports local, archive, remote, and mtp:// previews. |
| watch_dirs | watchDirs | dirs: Vec<String> | () | Non-recursive watch set per window; emits fs-changed after 200ms quiet period. |
| Rust Command | TS Wrapper | Arguments | Returns | Behavior |
|---|---|---|---|---|
| transfer_start | transferStart | spec: TransferSpec | u64 | Starts copy/move job with strategy learning; emits transfer-progress & job-finished. |
| transfer_adjust | transferAdjust | id: u64, what: String, value?, stop? | () | Live updates speed (KB/s), priority, time limit, startNow, or skipFolder. |
| transfer_resolve | transferResolve | id: u64, answer: String, all: bool | () | Resolves conflict gate (skip | replace | keepBoth) with optional sticky 'all'. |
| transfer_force_stop | transferForceStop | id: u64 | () | Abandons hung OS/SMB calls immediately, kills external tool, frees queue slot. |
| delete_start | deleteStart | paths: Vec<String>, permanent: bool | u64 | Background trash or permanent delete emitting delete-progress. |
| check_access / elevated_start | checkAccess / elevatedStart | job: Job | AccessCheck / u64 | Pre-flights permissions; launches self with --job <file> via UAC/polkit/osascript. |
| Rust Command | TS Wrapper | Arguments | Returns | Behavior |
|---|---|---|---|---|
| archive_start | archiveStart | action: 'compress'|'extract', paths, here | u64 | Pure-Rust zip/tar/7z or external 7-Zip/bsdtar unpack with zip-cloaking checks. |
| archive_paste_start / delete / rename | archivePasteStart ... | archive target + entries | u64 | () | Modifies zip/tar/tar.gz/7z via atomic temp archive rewrite and swap. |
| remote_connect / disconnect | remoteConnect / remoteDisconnect | server: Server, path? | String / () | Connects SFTP/FTP/WebDAV; handles untrusted-host:<fp> / changed-host:<fp>. |
| remote_copy_start / remove_start | remoteCopyStart / remoteRemoveStart | sources, dest, mv, open | u64 | Streams uploads, downloads, and server-to-server transfers via pooled connections. |
| share_start / share_stop | shareStart / shareStop | path, minutes, max_downloads, lan, internet | ShareInfo | 128-bit token LAN HTTP server + optional cloudflared quick tunnel. |
| Rust Command | TS Wrapper | Arguments | Returns | Behavior |
|---|---|---|---|---|
| term_spawn / attach / input / popout | termSpawn ... | cwd, cols, rows, sid, data | String / () | Controls detached PTY host; preserves shells across app restarts. |
| tasks_list / save / run / preview | tasksList / tasksSave ... | task: TaskDef | TaskState / Preview | Cron, interval, startup, watch, and drive-connect job automation. |
| lock_add / unlock / remove / relock | lockAdd / lockUnlock ... | path, passcode, main_password? | LocksState / bool | Argon2id passcode guard enforced in commands::guard across all path commands. |
| smart_clear_scan / analyze_start | smartClearScan / analyzeStart | drive / path | Report / () | 11-category cleanup report & WinDirStat treemap analyzer with live drive I/O. |
| system_report / cache_usage / compact_memory | systemReport / cacheUsage / compactMemory | refresh? | FullReport / Vec / (u64, u64) | Hardware/SMART telemetry, live per-cell cache stats, and glibc malloc_trim. |
Backend → Frontend Event Stream
transfer-progress • delete-progress • job-finished • dir-chunk • dir-updated • fs-changed • folder-size • search-hits • index-status • drives-changed • budget-changed • settings-changed • detached • tab-drop • tab-hover • reattach • term-out • analysis-partial / analysis-done / analysis-failed • smart-clear-progress • task-started / task-progress / task-finished • update-available / update-ready
7. Frontend Internals: Zustand Store, Pointer DnD & Virtualization
Pointer-Based Drag & Drop (src/dnd.ts): All in-app drags use pointer events rather than HTML5 Drag and Drop so Tauri’s native onDragDropEvent remains free for external OS drops (src/externalDrop.ts). While dragging, elementsFromPoint locates the nearest [data-drop="folder|pinitem|pins|section|tab"] ancestor and mutates data-drop-over / data-insert directly on the DOM—guaranteeing zero React re-renders per mouse move. Leaving the window hands off to native OS drag-out via native_dnd.rs (clipboard-rs and drag crates) with noteOwnDrag preventing self-drop loops.
Spreadsheet Selection & Undo Engine: FileView.tsx tracks anchor and base sets so Ctrl+Click followed by Shift+Click preserves earlier non-contiguous blocks. Meanwhile store.ts maintains dual undo/redo stacks of UndoAction records inverted symmetrically by reverse(action, dir).
Batch Rename Planner (src/util/batchRename.ts): planRenames computes conflict/validity diagnostics, then orderRenames topologically splits overlapping cycles (e.g., 1→2, 2→3) into collision-free temporary rounds.
8. Virtual Locations, Remote Protocols & Archive Verification
- URI Routing: Locations are strings routed across local OS paths,
fast://home|thispc|trash|search|analyze,archive://<file>!/<inside>,sftp://,ftp://,http(s)://(WebDAV), andmtp://<key>/<storage>/<path>. - Zip Cloaking & Traversal Defense:
browse.rscross-checks central-directory headers against local file headers before extraction, refuses entries escaping the destination viasafe_relative, and strips symlinks. - Pure-Rust Remote Stack: Zero OpenSSL or C toolchain dependencies—uses
russh+russh-sftp,suppaftp,rustls+quick-xml, andmtp-rs.
9. Detached PTY Host, Argon2id Locks, CSP & Crash Watchdog
- Terminal Host Daemon: Spawned via
--terminal-host, keeping shells alive across main-window closes and exiting cleanly 20 seconds after all shells finish and clients disconnect. - Argon2id Path Guard:
locks.rsstores Argon2id hashes inlocks.json;commands::guardwraps every path-reading and path-mutating command, returninglocked:<path>until unlocked in memory. - Content Security Policy (
tauri.conf.json):default-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline'; connect-src ipc: http://ipc.localhostguarantees custom user CSS cannot exfiltrate data or load remote assets. - Crash Watchdog (
crashlog.rs): Tracks a ~250-event ring buffer, intercepts panics and Windows SEH faults, and closes a hung webview after 15 s of silent heartbeat while writing a PII-scrubbed report.
10. CLI Flags, Microbenchmarks, Mobile Builds & CI
# Desktop dev & build
npm install
npm run app:dev # Vite HMR + Tauri Rust rebuilds
npm run app:build # Native NSIS/MSI/DMG/AppImage/DEB/RPM bundle
# Verification suite
cargo test --workspace # fast-core + src-tauri unit & integration tests
npm test # Vitest suite (formatting, DnD, presets, treemap, keys)
npm run build # tsc --noEmit + Vite bundle
# Engine microbenchmarks (crates/fast-core/examples/)
cargo run --release -p fast-core --example bench -- ~
cargo run --release -p fast-core --example transfer_bench -- SRC_DIR DEST_DIR
cargo run --release -p fast-core --example usage_bench -- ~
cargo run --release -p fast-core --example searchbench -- ~
cargo run --release -p fast-core --example startup_probe
# Mobile & version bump
npm run bump -- patch # Syncs Cargo.toml, tauri.conf.json, package.json, locks
npm run android:init && npm run android:build
npm run ios:init && npm run ios:build:unsignedInternal Helper CLI Flags (src-tauri/src/lib.rs): --minimized, --job <file>, --run-task <task.json> --result <f> --cancel <f>, --terminal-host, --terminal-attach, --restore-file-manager, and --admin-metrics.