Skip to main content

chkpt_core/scanner/
mod.rs

1pub mod matcher;
2pub mod walker;
3
4use crate::error::Result;
5use std::path::Path;
6
7#[derive(Debug, Clone)]
8pub struct ScannedFile {
9    pub relative_path: String,
10    pub absolute_path: std::path::PathBuf,
11    pub size: u64,
12    pub mtime_secs: i64,
13    pub mtime_nanos: i64,
14    pub device: Option<u64>,
15    pub inode: Option<u64>,
16    pub mode: u32,
17    pub is_symlink: bool,
18}
19
20/// Scan workspace, respecting .chkptignore and built-in exclusions.
21pub fn scan_workspace(root: &Path, chkptignore: Option<&Path>) -> Result<Vec<ScannedFile>> {
22    scan_workspace_with_options(root, chkptignore, false)
23}
24
25/// Scan workspace with configurable options.
26pub fn scan_workspace_with_options(
27    root: &Path,
28    chkptignore: Option<&Path>,
29    include_deps: bool,
30) -> Result<Vec<ScannedFile>> {
31    walker::walk_parallel(root, chkptignore, include_deps)
32}
33
34/// Scan workspace using the parallel walker.
35pub fn scan_workspace_parallel(
36    root: &Path,
37    chkptignore: Option<&Path>,
38) -> Result<Vec<ScannedFile>> {
39    walker::walk_parallel(root, chkptignore, false)
40}