pub struct WriterLease { /* private fields */ }Expand description
An acquired per-run writer lease; dropping it releases the lock.
Implementations§
Source§impl WriterLease
impl WriterLease
Sourcepub fn acquire(root: impl AsRef<Path>, run_id: &str) -> Result<Self, StoreError>
pub fn acquire(root: impl AsRef<Path>, run_id: &str) -> Result<Self, StoreError>
Takes the run’s lease without blocking. A lease held elsewhere —
another process, or another handle in this one — is
StoreError::WriterBusy; any other lock failure surfaces as
StoreError::Io.
Sourcepub fn is_held(root: impl AsRef<Path>, run_id: &str) -> bool
pub fn is_held(root: impl AsRef<Path>, run_id: &str) -> bool
Probes liveness: true iff some holder currently has the lease.
The probe try-locks and immediately unlocks + closes; it never
holds across anything else and creates nothing: a lease can only
be held on an existing lock file, so a missing file is false
without touching the filesystem. A lock file that exists but
cannot be opened answers true (fail closed: a probe that cannot
see must not vouch).
Trait Implementations§
Source§impl Debug for WriterLease
impl Debug for WriterLease
Source§impl Drop for WriterLease
impl Drop for WriterLease
Auto Trait Implementations§
impl Freeze for WriterLease
impl RefUnwindSafe for WriterLease
impl Send for WriterLease
impl Sync for WriterLease
impl Unpin for WriterLease
impl UnsafeUnpin for WriterLease
impl UnwindSafe for WriterLease
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