aboutsummaryrefslogtreecommitdiff
path: root/src/db/lmdb_adapter.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-08 17:49:36 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-08 17:49:36 +0200
commitab374e71787b1da37e1f885e88090bbcbd53ec47 (patch)
tree7863a488fdb9acf9d198fb992b34b67ca42f5f26 /src/db/lmdb_adapter.rs
parentf8a6fff2b7bb754fa315e1c00b0f6adea4586fa8 (diff)
downloadgarage-ab374e71787b1da37e1f885e88090bbcbd53ec47.tar.gz
garage-ab374e71787b1da37e1f885e88090bbcbd53ec47.zip
Add .clear() on db trees
Diffstat (limited to 'src/db/lmdb_adapter.rs')
-rw-r--r--src/db/lmdb_adapter.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/db/lmdb_adapter.rs b/src/db/lmdb_adapter.rs
index 74622919..30865829 100644
--- a/src/db/lmdb_adapter.rs
+++ b/src/db/lmdb_adapter.rs
@@ -139,6 +139,14 @@ impl IDb for LmdbDb {
Ok(old_val)
}
+ fn clear(&self, tree: usize) -> Result<()> {
+ let tree = self.get_tree(tree)?;
+ let mut tx = self.db.write_txn()?;
+ tree.clear(&mut tx)?;
+ tx.commit()?;
+ Ok(())
+ }
+
fn iter(&self, tree: usize) -> Result<ValueIter<'_>> {
let tree = self.get_tree(tree)?;
let tx = self.db.read_txn()?;