From b298e9f16e163314ba8d954619917ec4153c5cd1 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sun, 24 Apr 2022 19:50:51 +0200 Subject: [PATCH] datastore: s/fail_if_not_exist/assert_exists/ avoid putting whole sentences in parameter names Signed-off-by: Thomas Lamprecht --- pbs-datastore/src/chunk_store.rs | 12 ++++-------- pbs-datastore/src/datastore.rs | 8 ++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs index 94fe1dfe..8d7df513 100644 --- a/pbs-datastore/src/chunk_store.rs +++ b/pbs-datastore/src/chunk_store.rs @@ -204,19 +204,15 @@ impl ChunkStore { Ok(()) } - pub fn cond_touch_chunk( - &self, - digest: &[u8; 32], - fail_if_not_exist: bool, - ) -> Result { + pub fn cond_touch_chunk(&self, digest: &[u8; 32], assert_exists: bool) -> Result { // unwrap: only `None` in unit tests assert!(self.locker.is_some()); let (chunk_path, _digest_str) = self.chunk_path(digest); - self.cond_touch_path(&chunk_path, fail_if_not_exist) + self.cond_touch_path(&chunk_path, assert_exists) } - pub fn cond_touch_path(&self, path: &Path, fail_if_not_exist: bool) -> Result { + pub fn cond_touch_path(&self, path: &Path, assert_exists: bool) -> Result { // unwrap: only `None` in unit tests assert!(self.locker.is_some()); @@ -242,7 +238,7 @@ impl ChunkStore { })?; if let Err(err) = res { - if !fail_if_not_exist && err.as_errno() == Some(nix::errno::Errno::ENOENT) { + if !assert_exists && err.as_errno() == Some(nix::errno::Errno::ENOENT) { return Ok(false); } diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 7e52ea81..05442805 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -959,14 +959,10 @@ impl DataStore { self.inner.chunk_store.chunk_path(digest) } - pub fn cond_touch_chunk( - &self, - digest: &[u8; 32], - fail_if_not_exist: bool, - ) -> Result { + pub fn cond_touch_chunk(&self, digest: &[u8; 32], assert_exists: bool) -> Result { self.inner .chunk_store - .cond_touch_chunk(digest, fail_if_not_exist) + .cond_touch_chunk(digest, assert_exists) } pub fn insert_chunk(&self, chunk: &DataBlob, digest: &[u8; 32]) -> Result<(bool, u64), Error> {