diff options
author | Alex Auvolat <alex@adnab.me> | 2022-06-08 17:49:36 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-06-08 17:49:36 +0200 |
commit | ab374e71787b1da37e1f885e88090bbcbd53ec47 (patch) | |
tree | 7863a488fdb9acf9d198fb992b34b67ca42f5f26 /src/db/sled_adapter.rs | |
parent | f8a6fff2b7bb754fa315e1c00b0f6adea4586fa8 (diff) | |
download | garage-ab374e71787b1da37e1f885e88090bbcbd53ec47.tar.gz garage-ab374e71787b1da37e1f885e88090bbcbd53ec47.zip |
Add .clear() on db trees
Diffstat (limited to 'src/db/sled_adapter.rs')
-rw-r--r-- | src/db/sled_adapter.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/db/sled_adapter.rs b/src/db/sled_adapter.rs index 982f8d82..cf61867d 100644 --- a/src/db/sled_adapter.rs +++ b/src/db/sled_adapter.rs @@ -113,6 +113,12 @@ impl IDb for SledDb { Ok(old_val.map(|x| x.to_vec())) } + fn clear(&self, tree: usize) -> Result<()> { + let tree = self.get_tree(tree)?; + tree.clear()?; + Ok(()) + } + fn iter(&self, tree: usize) -> Result<ValueIter<'_>> { let tree = self.get_tree(tree)?; Ok(Box::new(tree.iter().map(|v| { |