aboutsummaryrefslogtreecommitdiff
path: root/src/db/lib.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-09-10 09:06:29 +0000
committerAlex <alex@adnab.me>2024-09-10 09:06:29 +0000
commit586957b4b7261b43e7820d7193516153201b4954 (patch)
treeff57ef1a40dc5bd888a6fdfe36dd8cd119626e61 /src/db/lib.rs
parent8d2bb4afeba6a90ba12a41144246e3b08eac70f8 (diff)
parent8062ec7b4b6115e6158ec1b5523b4bd8dc0185be (diff)
downloadgarage-586957b4b7261b43e7820d7193516153201b4954.tar.gz
garage-586957b4b7261b43e7820d7193516153201b4954.zip
Merge pull request 'KV: don't retrieve values for write ops' (#873) from marvinj97/garage:perf/kv/insert-no-return into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/873 Reviewed-by: Alex <alex@adnab.me>
Diffstat (limited to 'src/db/lib.rs')
-rw-r--r--src/db/lib.rs12
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<'_>>;