From f25309e58f839d1fad6b094cd33d7f36b5c3e2e0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 3 Jun 2022 10:44:54 +0200 Subject: Change value type to be a dyn thing --- src/table/data.rs | 2 +- src/table/gc.rs | 7 +++++-- src/table/merkle.rs | 11 ++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/table') 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), } })?; -- cgit v1.2.3