From 2515ff35c23e224777b116b96c8d72459e75ba09 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 3 Jun 2022 10:15:41 +0200 Subject: [PATCH] datastore: reduce chunk store open visibility and comment pitfalls Signed-off-by: Thomas Lamprecht --- pbs-datastore/src/chunk_store.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs index c142c05a..c9714c1e 100644 --- a/pbs-datastore/src/chunk_store.rs +++ b/pbs-datastore/src/chunk_store.rs @@ -153,7 +153,12 @@ impl ChunkStore { lockfile_path } - pub fn open>(name: &str, base: P) -> Result { + /// Opens the chunk store with a new process locker. + /// + /// Note that this must be used with care, as it's dangerous to create two instances on the + /// same base path, as closing the underlying ProcessLocker drops all locks from this process + /// on the lockfile (even if separate FDs) + pub(crate) fn open>(name: &str, base: P) -> Result { let base: PathBuf = base.into(); if !base.is_absolute() {