Expand description
File system scanning engine for gravityfile.
This crate provides high-performance parallel directory scanning using jwalk for traversal.
§Overview
gravityfile-scan is responsible for traversing directories and building
the file tree structure. Key features:
- Parallel traversal via jwalk/rayon
- Progress updates via broadcast channels
- Hardlink detection to avoid double-counting
- Configurable depth limits, ignore patterns, etc.
§Example
use gravityfile_scan::{JwalkScanner, ScanConfig};
let config = ScanConfig::new("/path/to/scan");
let scanner = JwalkScanner::new();
let tree = scanner.scan(&config).unwrap();
println!("Total size: {} bytes", tree.total_size());
println!("Total files: {}", tree.total_files());§Progress Monitoring
Subscribe to real-time progress updates:
use gravityfile_scan::{JwalkScanner, ScanConfig};
let scanner = JwalkScanner::new();
let mut progress_rx = scanner.subscribe();
// Handle progress in a separate task
tokio::spawn(async move {
while let Ok(progress) = progress_rx.recv().await {
println!("Scanned {} files", progress.files_scanned);
}
});Structs§
- File
Node - A single file or directory in the tree.
- File
Tree - Complete scanned file tree with metadata.
- GitStatus
Cache - Git status cache for efficient lookups.
- Inode
Tracker - Tracks seen inodes to prevent double-counting hardlinks.
- Jwalk
Scanner - High-performance scanner using jwalk for parallel traversal.
- NodeId
- Unique identifier for a node within a tree.
- Scan
Config - Configuration for scanning operations.
- Scan
Progress - Progress information during a scan.
- Scan
Warning - Non-fatal warning encountered during scan.
- Timestamps
- File metadata timestamps.
- Tree
Stats - Summary statistics for a scanned tree.
Enums§
- Node
Kind - Type of file system node.
- Scan
Error - Errors that can occur during scanning.
- Warning
Kind - Kind of scan warning.
Functions§
- apply_
git_ status - Apply git statuses to a file tree in-place.
- quick_
list - Create a quick, non-recursive directory listing for immediate display. This function reads only the immediate children of a directory without recursing into subdirectories. Directory sizes will be 0 (unknown).