aboutsummaryrefslogtreecommitdiff
path: root/src/db/lib.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-09-14 15:57:27 +0000
committerAlex <alex@adnab.me>2024-09-14 15:57:27 +0000
commit6da135354135d8d8a5d2476bfbcd4aab91abfc3c (patch)
tree5028687340c272ba522de8084167034e8f2eaad0 /src/db/lib.rs
parent586957b4b7261b43e7820d7193516153201b4954 (diff)
parentbd71728874e7f03c547246cb0076804f62db102f (diff)
downloadgarage-6da135354135d8d8a5d2476bfbcd4aab91abfc3c.tar.gz
garage-6da135354135d8d8a5d2476bfbcd4aab91abfc3c.zip
Merge pull request 'Don't fetch old values in cross-partition transactional inserts' (#877) from withings/garage:perf/kv/insert-no-return-cross-partition into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/877
Diffstat (limited to 'src/db/lib.rs')
-rw-r--r--src/db/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/db/lib.rs b/src/db/lib.rs
index d6057505..3485745a 100644
--- a/src/db/lib.rs
+++ b/src/db/lib.rs
@@ -274,12 +274,12 @@ impl<'a> Transaction<'a> {
tree: &Tree,
key: T,
value: U,
- ) -> TxOpResult<Option<Value>> {
+ ) -> TxOpResult<()> {
self.tx.insert(tree.1, key.as_ref(), value.as_ref())
}
/// Returns the old value if there was one
#[inline]
- pub fn remove<T: AsRef<[u8]>>(&mut self, tree: &Tree, key: T) -> TxOpResult<Option<Value>> {
+ pub fn remove<T: AsRef<[u8]>>(&mut self, tree: &Tree, key: T) -> TxOpResult<()> {
self.tx.remove(tree.1, key.as_ref())
}
/// Clears all values in a tree
@@ -362,8 +362,8 @@ pub(crate) trait ITx {
fn get(&self, tree: usize, key: &[u8]) -> TxOpResult<Option<Value>>;
fn len(&self, tree: usize) -> TxOpResult<usize>;
- fn insert(&mut self, tree: usize, key: &[u8], value: &[u8]) -> TxOpResult<Option<Value>>;
- fn remove(&mut self, tree: usize, key: &[u8]) -> TxOpResult<Option<Value>>;
+ fn insert(&mut self, tree: usize, key: &[u8], value: &[u8]) -> TxOpResult<()>;
+ fn remove(&mut self, tree: usize, key: &[u8]) -> TxOpResult<()>;
fn clear(&mut self, tree: usize) -> TxOpResult<()>;
fn iter(&self, tree: usize) -> TxOpResult<TxValueIter<'_>>;