garage_db: rename len to approximate_len as it is used for stats only

This commit is contained in:
Alex Auvolat
2025-08-27 21:17:32 +02:00
parent a64b567d43
commit 90bba5889a
15 changed files with 69 additions and 44 deletions
+5 -1
View File
@@ -160,7 +160,7 @@ impl IDb for SqliteDb {
self.internal_get(&self.db.get()?, &tree, key)
}
fn len(&self, tree: usize) -> Result<usize> {
fn approximate_len(&self, tree: usize) -> Result<usize> {
let tree = self.get_tree(tree)?;
let db = self.db.get()?;
@@ -172,6 +172,10 @@ impl IDb for SqliteDb {
}
}
fn is_empty(&self, tree: usize) -> Result<bool> {
Ok(self.approximate_len(tree)? == 0)
}
fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result<()> {
let tree = self.get_tree(tree)?;
let db = self.db.get()?;