1use anyhow::Result;
4use incrededup::lsh::DiskLSH;
5use incrededup::storage::{MatchStore, StateStore};
6use std::env;
7
8fn main() -> Result<()> {
9 let args: Vec<String> = env::args().collect();
10 if args.len() != 2 {
11 eprintln!("Usage: stats <dataset_path>");
12 std::process::exit(1);
13 }
14
15 let base_path = std::path::Path::new(&args[1]);
16
17 println!("=== LSH Index ===");
18 let lsh_path = base_path.join("lsh.redb");
19 if lsh_path.exists() {
20 let lsh = DiskLSH::open(&lsh_path)?;
21 println!(" Documents: {}", lsh.count()?);
22 } else {
23 println!(" NOT FOUND");
24 }
25
26 println!("\n=== Sync State ===");
27 let state_path = base_path.join("state.redb");
28 if state_path.exists() {
29 let state = StateStore::open(&state_path)?;
30 let progress = state.get_sync_progress()?;
31 println!(" Step: {:?}", progress.step);
32 println!(
33 " Dupes: {}/{}",
34 progress.dupes_written, progress.dupes_total
35 );
36 println!(
37 " Parents: {}/{}",
38 progress.parents_marked, progress.parents_total
39 );
40 println!(
41 " Children: {}/{}",
42 progress.children_marked, progress.children_total
43 );
44 } else {
45 println!(" NOT FOUND");
46 }
47
48 println!("\n=== Match Store ===");
49 let match_path = base_path.join("matches.redb");
50 if match_path.exists() {
51 let matches = MatchStore::open(&match_path)?;
52 println!(" Total matches: {}", matches.count()?);
53 } else {
54 println!(" NOT FOUND");
55 }
56
57 Ok(())
58}