datastore: s/fail_if_not_exist/assert_exists/
avoid putting whole sentences in parameter names Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
cc295e2c7a
commit
b298e9f16e
|
@ -204,19 +204,15 @@ impl ChunkStore {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cond_touch_chunk(
|
pub fn cond_touch_chunk(&self, digest: &[u8; 32], assert_exists: bool) -> Result<bool, Error> {
|
||||||
&self,
|
|
||||||
digest: &[u8; 32],
|
|
||||||
fail_if_not_exist: bool,
|
|
||||||
) -> Result<bool, Error> {
|
|
||||||
// unwrap: only `None` in unit tests
|
// unwrap: only `None` in unit tests
|
||||||
assert!(self.locker.is_some());
|
assert!(self.locker.is_some());
|
||||||
|
|
||||||
let (chunk_path, _digest_str) = self.chunk_path(digest);
|
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<bool, Error> {
|
pub fn cond_touch_path(&self, path: &Path, assert_exists: bool) -> Result<bool, Error> {
|
||||||
// unwrap: only `None` in unit tests
|
// unwrap: only `None` in unit tests
|
||||||
assert!(self.locker.is_some());
|
assert!(self.locker.is_some());
|
||||||
|
|
||||||
|
@ -242,7 +238,7 @@ impl ChunkStore {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Err(err) = res {
|
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);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -959,14 +959,10 @@ impl DataStore {
|
||||||
self.inner.chunk_store.chunk_path(digest)
|
self.inner.chunk_store.chunk_path(digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cond_touch_chunk(
|
pub fn cond_touch_chunk(&self, digest: &[u8; 32], assert_exists: bool) -> Result<bool, Error> {
|
||||||
&self,
|
|
||||||
digest: &[u8; 32],
|
|
||||||
fail_if_not_exist: bool,
|
|
||||||
) -> Result<bool, Error> {
|
|
||||||
self.inner
|
self.inner
|
||||||
.chunk_store
|
.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> {
|
pub fn insert_chunk(&self, chunk: &DataBlob, digest: &[u8; 32]) -> Result<(bool, u64), Error> {
|
||||||
|
|
Loading…
Reference in New Issue