pub struct WorkspaceWriteLock { /* private fields */ }Expand description
Exclusive write guard for one canonical log path.
The guard creates <canonical-log>.lock using create_new(true),
so acquisition is atomic across processes on local filesystems. The
lockfile is removed when the guard drops. If a process crashes, the
file can remain behind; operators should inspect and remove that
stale file deliberately rather than have Mimir guess liveness.
Implementations§
Source§impl WorkspaceWriteLock
impl WorkspaceWriteLock
Sourcepub fn acquire_for_log(
log_path: impl AsRef<Path>,
) -> Result<Self, WorkspaceLockError>
pub fn acquire_for_log( log_path: impl AsRef<Path>, ) -> Result<Self, WorkspaceLockError>
Acquire the lock associated with log_path.
§Errors
Returns WorkspaceLockError::AlreadyHeld when another
holder’s lockfile already exists, or
WorkspaceLockError::Io for filesystem failures creating,
writing, or syncing the lockfile.
Sourcepub fn acquire_for_log_with_owner(
log_path: impl AsRef<Path>,
owner: impl AsRef<str>,
) -> Result<Self, WorkspaceLockError>
pub fn acquire_for_log_with_owner( log_path: impl AsRef<Path>, owner: impl AsRef<str>, ) -> Result<Self, WorkspaceLockError>
Acquire the lock associated with log_path and write an
operator-visible owner string into the lockfile.
§Errors
Same as Self::acquire_for_log.
Trait Implementations§
Source§impl Debug for WorkspaceWriteLock
impl Debug for WorkspaceWriteLock
Auto Trait Implementations§
impl Freeze for WorkspaceWriteLock
impl RefUnwindSafe for WorkspaceWriteLock
impl Send for WorkspaceWriteLock
impl Sync for WorkspaceWriteLock
impl Unpin for WorkspaceWriteLock
impl UnsafeUnpin for WorkspaceWriteLock
impl UnwindSafe for WorkspaceWriteLock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more