datastore: add single-level and recursive namespace iterators

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2022-04-24 20:23:30 +02:00
parent 02ec2ae9b8
commit 90e3869690
3 changed files with 222 additions and 6 deletions

View File

@ -12,12 +12,16 @@ fn run() -> Result<(), Error> {
let store = unsafe { DataStore::open_path("", &base, None)? };
for group in store.iter_backup_groups(Default::default())? {
let group = group?;
println!("found group {}", group);
for ns in store.recursive_iter_backup_ns_ok(Default::default())? {
println!("found namespace store:/{}", ns);
for snapshot in group.iter_snapshots()? {
println!("\t{}", snapshot?);
for group in store.iter_backup_groups(ns)? {
let group = group?;
println!(" found group {}", group);
for snapshot in group.iter_snapshots()? {
println!("\t{}", snapshot?);
}
}
}