aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-14 16:16:55 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-14 16:16:55 +0100
commit13c86621267272af5bc89ec037d097739dae9aaf (patch)
tree2be2c711dc490a1eb3250b4f2333904f6a276b96
parente6f14ab5cfe985106092afa228258eeb7d5d8905 (diff)
downloadgarage-13c86621267272af5bc89ec037d097739dae9aaf.tar.gz
garage-13c86621267272af5bc89ec037d097739dae9aaf.zip
factorize
-rw-r--r--src/table/data.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/table/data.rs b/src/table/data.rs
index bf2bf88b..40856b02 100644
--- a/src/table/data.rs
+++ b/src/table/data.rs
@@ -330,13 +330,12 @@ where
let mut entry = self.decode_entry(&old_v).map_err(db::TxError::Abort)?;
entry.merge(ins);
rmp_to_vec_all_named(&entry)
- .map_err(Error::RmpEncode)
- .map_err(db::TxError::Abort)?
}
- None => rmp_to_vec_all_named(ins)
- .map_err(Error::RmpEncode)
- .map_err(db::TxError::Abort)?,
+ None => rmp_to_vec_all_named(ins),
};
+ let new_entry = new_entry
+ .map_err(Error::RmpEncode)
+ .map_err(db::TxError::Abort)?;
tx.insert(&self.insert_queue, &tree_key, new_entry)?;
self.insert_queue_notify.notify_one();