Warren
05f89ea1ac
feat: Add file scan and async hash system
Features:
1. scan command - Fast import without hash (skip_hash=true)
- Scans directory structure
- Generates deterministic UUIDs (SHA256(path|name|mac|mtime))
- Stores full path in aliases.json
- Inserts nodes in batches
- Performance: 14243 nodes/sec (11857 files in 0.89s)
2. hash command - Async hash calculation
- Multi-threaded (default: 4 threads)
- Reads paths from aliases.json
- Updates database with SHA256 hashes
- Performance: 28 files/sec (11857 files in 417.58s)
Design:
- Import first, hash later (user can view tree immediately)
- Hash runs in background (non-blocking)
- Path stored in aliases.json (temporary solution)
- Deterministic UUIDs (same file = same UUID)
Performance breakdown:
- Scanning: 0.10s (11%)
- ID generation: 0.57s (64%)
- DB insertion: 0.21s (24%)
- Hash: 417.58s (async, background)
Files:
- src/scan.rs (new, 499 lines)
- src/main.rs (scan/hash commands)
- src/lib.rs (scan module)
Test result:
- warren user: 12658 nodes imported
- 11857 hashes calculated successfully
2026-05-17 03:20:35 +08:00
..
2026-05-16 15:37:37 +08:00
2026-05-17 03:20:35 +08:00
2026-05-17 03:20:35 +08:00
2026-05-16 20:47:28 +08:00