diff options
author | Alex <alex@adnab.me> | 2023-09-21 14:03:35 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-09-21 14:03:35 +0000 |
commit | 1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f (patch) | |
tree | 5b5f8d66637c4a10866b00e07a45081c93cf75cf /src/db/counted_tree_hack.rs | |
parent | fd7d8fec59c617b40e480ff855894cf35fdcfb40 (diff) | |
parent | 0635250b2bdcce4156704128de154f9052d34e9e (diff) | |
download | garage-1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f.tar.gz garage-1d986bd889a5f5fe1bdc75e7d4b34acc2cfbe09f.zip |
Merge pull request 'Refactor db transactions and add on_commit for table.queue_insert' (#637) from k2v-indices-lmdb into next
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/637
Diffstat (limited to 'src/db/counted_tree_hack.rs')
-rw-r--r-- | src/db/counted_tree_hack.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/db/counted_tree_hack.rs b/src/db/counted_tree_hack.rs index bbe943a2..a4ce12e0 100644 --- a/src/db/counted_tree_hack.rs +++ b/src/db/counted_tree_hack.rs @@ -85,7 +85,7 @@ impl CountedTree { let old_some = expected_old.is_some(); let new_some = new.is_some(); - let tx_res = self.0.tree.db().transaction(|mut tx| { + let tx_res = self.0.tree.db().transaction(|tx| { let old_val = tx.get(&self.0.tree, &key)?; let is_same = match (&old_val, &expected_old) { (None, None) => true, @@ -101,9 +101,9 @@ impl CountedTree { tx.remove(&self.0.tree, &key)?; } } - tx.commit(()) + Ok(()) } else { - tx.abort(()) + Err(TxError::Abort(())) } }); |