datastore: reduce chunk store open visibility and comment pitfalls

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-06-03 10:15:41 +02:00
parent 33a1ef7aae
commit 2515ff35c2

View 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() {