aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-03 10:44:54 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-03 10:44:54 +0200
commitf25309e58f839d1fad6b094cd33d7f36b5c3e2e0 (patch)
tree83046dd98bb625db085bf5e457951974c1a6e5d7 /src/table
parent7b7990635029776e8878f3b04ed7ca48192899a3 (diff)
downloadgarage-f25309e58f839d1fad6b094cd33d7f36b5c3e2e0.tar.gz
garage-f25309e58f839d1fad6b094cd33d7f36b5c3e2e0.zip
Change value type to be a dyn thing
Diffstat (limited to 'src/table')
-rw-r--r--src/table/data.rs2
-rw-r--r--src/table/gc.rs7
-rw-r--r--src/table/merkle.rs11
3 files changed, 12 insertions, 8 deletions
diff --git a/src/table/data.rs b/src/table/data.rs
index ebfae551..dc1fd445 100644
--- a/src/table/data.rs
+++ b/src/table/data.rs
@@ -276,7 +276,7 @@ where
if blake2sum(&cur_v[..]) == vhash {
tx.remove(&self.store, k)?;
tx.insert(&self.merkle_todo, k, vec![])?;
- return Ok(Some(cur_v.into_owned()));
+ return Ok(Some(cur_v.into_vec()));
}
}
Ok(None)
diff --git a/src/table/gc.rs b/src/table/gc.rs
index 04872a38..260fecfa 100644
--- a/src/table/gc.rs
+++ b/src/table/gc.rs
@@ -378,8 +378,11 @@ impl GcTodoEntry {
let key = self.todo_table_key();
gc_todo_tree.db().transaction(|tx| {
let old_val = tx.get(gc_todo_tree, &key)?;
- if old_val == Some(self.value_hash.as_slice().into()) {
- tx.remove(gc_todo_tree, &key)?;
+ match old_val {
+ Some(ov) if ov == self.value_hash.as_slice() => {
+ tx.remove(gc_todo_tree, &key)?;
+ }
+ _ => (),
}
tx.commit(())
})?;
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index 6e0c2f7e..f7dca97b 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -142,11 +142,12 @@ where
let deleted = self.data.merkle_todo.db().transaction(|tx| {
let old_val = tx.get(&self.data.merkle_todo, k)?;
- if old_val == Some(vhash_by.into()) {
- tx.remove(&self.data.merkle_todo, k)?;
- tx.commit(true)
- } else {
- tx.commit(false)
+ match old_val {
+ Some(ov) if ov == vhash_by => {
+ tx.remove(&self.data.merkle_todo, k)?;
+ tx.commit(true)
+ }
+ _ => tx.commit(false),
}
})?;