From f8ebdce372d02bbddfa7985b5f84bce28cb836a6 Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Sat, 20 Apr 2024 23:46:53 +0200 Subject: [PATCH] make the keyspace methods non-public --- lib/store/src/transaction.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/store/src/transaction.rs b/lib/store/src/transaction.rs index 10bd664..03c2544 100644 --- a/lib/store/src/transaction.rs +++ b/lib/store/src/transaction.rs @@ -334,7 +334,7 @@ struct Keyspace<'db> { impl<'db> Keyspace<'db> { /// Retrieve a value from the database. Returns `Missing` if the key does not exist. - pub fn get(&self, key: impl AsRef<[u8]>) -> Result + 'db> { + fn get(&self, key: impl AsRef<[u8]>) -> Result + 'db> { self.tx .inner .get_pinned_cf(&self.cf, key) @@ -342,25 +342,25 @@ impl<'db> Keyspace<'db> { .and_then(|opt| opt.ok_or(Error::Missing)) } /// Set the value at `key` to `val`. - pub fn set(&self, key: impl AsRef<[u8]>, val: impl AsRef<[u8]>) -> Result<()> { + fn set(&self, key: impl AsRef<[u8]>, val: impl AsRef<[u8]>) -> Result<()> { self.tx .inner .put_cf(&self.cf, key, val) .map_err(Error::Internal) } /// Delete the key-value pair identified by `key`. - pub fn del(&self, key: impl AsRef<[u8]>) -> Result<()> { + fn del(&self, key: impl AsRef<[u8]>) -> Result<()> { self.tx.inner.delete_cf(&self.cf, &key)?; OK } /// Remove the key and associated value from the keyspace, and return its previous value. - pub fn pop(&self, key: impl AsRef<[u8]>) -> Result>> { + fn pop(&self, key: impl AsRef<[u8]>) -> Result>> { let old = self.tx.inner.get_for_update_cf(&self.cf, &key, true)?; self.del(key)?; Ok(old) } /// Check whether the key exists in the keyspace. - pub fn has(&self, key: impl AsRef<[u8]>) -> Result { + fn has(&self, key: impl AsRef<[u8]>) -> Result { self.tx .inner .get_pinned_cf(&self.cf, key) @@ -368,7 +368,7 @@ impl<'db> Keyspace<'db> { .map(|opt| opt.is_some()) } /// Execute a prefix scan. - pub fn scan( + fn scan( &self, prefix: impl AsRef<[u8]> + 'db, ) -> impl Iterator + 'static, impl AsRef<[u8]> + 'static)>> + 'db @@ -386,7 +386,7 @@ impl<'db> Keyspace<'db> { .map(|r| r.map_err(Error::Internal)) } /// Show all items in the entire keyspace. - pub fn list( + fn list( &self, ) -> impl Iterator + 'static, impl AsRef<[u8]> + 'static)>> + 'db {