aboutsummaryrefslogtreecommitdiff
path: root/src/garage/admin_rpc.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-15 23:14:12 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-15 23:14:12 +0100
commit6a8439fd1345ecae7414386f76dda7a03eb14df2 (patch)
treea6306030d7f0cc41158512e600683b8874f7d85e /src/garage/admin_rpc.rs
parent0cd5b2ae19965b8c1f3176afeb8f678c4d8366dd (diff)
downloadgarage-6a8439fd1345ecae7414386f76dda7a03eb14df2.tar.gz
garage-6a8439fd1345ecae7414386f76dda7a03eb14df2.zip
Some improvements in background worker but we terminate late
Diffstat (limited to 'src/garage/admin_rpc.rs')
-rw-r--r--src/garage/admin_rpc.rs29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/garage/admin_rpc.rs b/src/garage/admin_rpc.rs
index 40674e75..b2145ca5 100644
--- a/src/garage/admin_rpc.rs
+++ b/src/garage/admin_rpc.rs
@@ -193,7 +193,12 @@ impl AdminRpcHandler {
let key_ids = self
.garage
.key_table
- .get_range(&EmptyKey, None, Some(KeyFilter::Deleted(DeletedFilter::NotDeleted)), 10000)
+ .get_range(
+ &EmptyKey,
+ None,
+ Some(KeyFilter::Deleted(DeletedFilter::NotDeleted)),
+ 10000,
+ )
.await?
.iter()
.map(|k| (k.key_id.to_string(), k.name.get().clone()))
@@ -257,15 +262,24 @@ impl AdminRpcHandler {
}
async fn get_existing_key(&self, pattern: &str) -> Result<Key, Error> {
- let candidates = self.garage
+ let candidates = self
+ .garage
.key_table
- .get_range(&EmptyKey, None, Some(KeyFilter::Matches(pattern.to_string())), 10)
+ .get_range(
+ &EmptyKey,
+ None,
+ Some(KeyFilter::Matches(pattern.to_string())),
+ 10,
+ )
.await?
.into_iter()
.filter(|k| !k.deleted.get())
.collect::<Vec<_>>();
if candidates.len() != 1 {
- Err(Error::Message(format!("{} matching keys", candidates.len())))
+ Err(Error::Message(format!(
+ "{} matching keys",
+ candidates.len()
+ )))
} else {
Ok(candidates.into_iter().next().unwrap())
}
@@ -469,12 +483,7 @@ impl AdminRpcHandler {
t.data.merkle_updater.merkle_tree_len()
)
.unwrap();
- writeln!(
- to,
- " GC todo queue length: {}",
- t.data.gc_todo_len()
- )
- .unwrap();
+ writeln!(to, " GC todo queue length: {}", t.data.gc_todo_len()).unwrap();
Ok(())
}
}