diff options
author | marvin-j97 <marvin.janke.97@gmail.com> | 2024-09-04 18:45:17 +0200 |
---|---|---|
committer | marvin-j97 <marvin.janke.97@gmail.com> | 2024-09-04 18:45:17 +0200 |
commit | 74363c906065a559beef4c3c93e8f73a7ecff437 (patch) | |
tree | de3683f54e5cebb27f3b17b01dce9f87c86aca63 /src/db/lib.rs | |
parent | 615698df7d2d3867fd3d9cbdf8d8849a9de358bf (diff) | |
download | garage-74363c906065a559beef4c3c93e8f73a7ecff437.tar.gz garage-74363c906065a559beef4c3c93e8f73a7ecff437.zip |
perf(kv): dont retrieve values for write ops
see https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/851
Diffstat (limited to 'src/db/lib.rs')
-rw-r--r-- | src/db/lib.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/db/lib.rs b/src/db/lib.rs index c8f9e13f..d6057505 100644 --- a/src/db/lib.rs +++ b/src/db/lib.rs @@ -211,16 +211,12 @@ impl Tree { /// Returns the old value if there was one #[inline] - pub fn insert<T: AsRef<[u8]>, U: AsRef<[u8]>>( - &self, - key: T, - value: U, - ) -> Result<Option<Value>> { + pub fn insert<T: AsRef<[u8]>, U: AsRef<[u8]>>(&self, key: T, value: U) -> Result<()> { self.0.insert(self.1, key.as_ref(), value.as_ref()) } /// Returns the old value if there was one #[inline] - pub fn remove<T: AsRef<[u8]>>(&self, key: T) -> Result<Option<Value>> { + pub fn remove<T: AsRef<[u8]>>(&self, key: T) -> Result<()> { self.0.remove(self.1, key.as_ref()) } /// Clears all values from the tree @@ -339,8 +335,8 @@ pub(crate) trait IDb: Send + Sync { fn get(&self, tree: usize, key: &[u8]) -> Result<Option<Value>>; fn len(&self, tree: usize) -> Result<usize>; - fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result<Option<Value>>; - fn remove(&self, tree: usize, key: &[u8]) -> Result<Option<Value>>; + fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result<()>; + fn remove(&self, tree: usize, key: &[u8]) -> Result<()>; fn clear(&self, tree: usize) -> Result<()>; fn iter(&self, tree: usize) -> Result<ValueIter<'_>>; |