compact.rs
1use anyhow::Result;
2use std::path::Path;
3
4use crate::db;
5
6pub fn run(root: &Path) -> Result<()> {
7 let store = db::open(root)?;
8 let c = crate::color::stderr_theme();
9 eprintln!("{}info:{} writing compacted snapshot...", c.blue, c.reset);
10 let out = store.write_snapshot()?;
11 let removed = store.purge_deltas()?;
12 eprintln!("{}info:{} wrote {}", c.blue, c.reset, out.display());
13 eprintln!("{}info:{} removed {removed} delta file(s)", c.blue, c.reset);
14 Ok(())
15}