]> git.proxmox.com Git - proxmox-backup.git/commitdiff
datastore: reduce chunk store open visibility and comment pitfalls
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 3 Jun 2022 08:15:41 +0000 (10:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 3 Jun 2022 08:15:41 +0000 (10:15 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
pbs-datastore/src/chunk_store.rs

index c142c05a9d245b4aca42f35c1a16dd41f7ca3d98..c9714c1e0131a3700700f1d649709ee26a42ce4c 100644 (file)
@@ -153,7 +153,12 @@ impl ChunkStore {
         lockfile_path
     }
 
-    pub fn open<P: Into<PathBuf>>(name: &str, base: P) -> Result<Self, Error> {
+    /// 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<P: Into<PathBuf>>(name: &str, base: P) -> Result<Self, Error> {
         let base: PathBuf = base.into();
 
         if !base.is_absolute() {