Skip to main content

Crate gravityfile_scan

Crate gravityfile_scan 

Source
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§

FileNode
A single file or directory in the tree.
FileTree
Complete scanned file tree with metadata.
GitStatusCache
Git status cache for efficient lookups.
InodeTracker
Tracks seen inodes to prevent double-counting hardlinks.
JwalkScanner
High-performance scanner using jwalk for parallel traversal.
NodeId
Unique identifier for a node within a tree.
ScanConfig
Configuration for scanning operations.
ScanProgress
Progress information during a scan.
ScanWarning
Non-fatal warning encountered during scan.
Timestamps
File metadata timestamps.
TreeStats
Summary statistics for a scanned tree.

Enums§

NodeKind
Type of file system node.
ScanError
Errors that can occur during scanning.
WarningKind
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).