2022-04-15 10:24:56 +00:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
use anyhow::{bail, Error};
|
|
|
|
|
2022-04-20 13:30:04 +00:00
|
|
|
use pbs_datastore::DataStore;
|
2022-04-15 10:24:56 +00:00
|
|
|
|
|
|
|
fn run() -> Result<(), Error> {
|
|
|
|
let base: PathBuf = match std::env::args().skip(1).next() {
|
|
|
|
Some(path) => path.into(),
|
|
|
|
None => bail!("no path passed"),
|
|
|
|
};
|
|
|
|
|
2022-04-20 13:30:04 +00:00
|
|
|
let store = unsafe { DataStore::open_path("", &base, None)? };
|
|
|
|
|
2022-04-24 18:23:30 +00:00
|
|
|
for ns in store.recursive_iter_backup_ns_ok(Default::default())? {
|
|
|
|
println!("found namespace store:/{}", ns);
|
2022-04-15 10:24:56 +00:00
|
|
|
|
2022-04-24 18:23:30 +00:00
|
|
|
for group in store.iter_backup_groups(ns)? {
|
|
|
|
let group = group?;
|
|
|
|
println!(" found group {}", group);
|
|
|
|
|
|
|
|
for snapshot in group.iter_snapshots()? {
|
|
|
|
println!("\t{}", snapshot?);
|
|
|
|
}
|
2022-04-15 10:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
std::process::exit(match run() {
|
|
|
|
Ok(_) => 0,
|
|
|
|
Err(err) => {
|
|
|
|
eprintln!("error: {}", err);
|
|
|
|
1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|