pub enum LockState {
Free,
Held(LockHolder),
LeaseExpired(LockHolder),
HolderGone(LockHolder),
Unreadable,
}Expand description
What DirLock::inspect read out of the lock file, having changed nothing to read it.
Variants§
Free
There is no lock file: nothing stands between the next writer and the directory.
Held(LockHolder)
A writer holds the directory on a lease it is still renewing.
LeaseExpired(LockHolder)
Nobody renewed the lease within stale_after_ms. It is still this holder’s until the
hand-over grace DirLock::acquire owes it has passed.
HolderGone(LockHolder)
The holding process is gone on this host, so nothing is left to renew the lease and the
next writer takes the lock outright. Unix only — elsewhere such a lock reads as Held
until its lease runs out.
Unreadable
A lock file this engine cannot read: written by an older format, or by something else
entirely. It is reclaimed as abandoned once stale_after_ms has passed since it was last
touched, so it blocks a writer meanwhile.
Implementations§
Source§impl LockState
impl LockState
Sourcepub fn holder(&self) -> Option<&LockHolder>
pub fn holder(&self) -> Option<&LockHolder>
The holder the lock file names, where there is one — None for a directory nobody holds
and for a lock file that does not parse.
Sourcepub fn blocks_a_writer(&self) -> bool
pub fn blocks_a_writer(&self) -> bool
Whether a writer opening the directory at this moment would have to wait for somebody.
False for LockState::HolderGone as well as LockState::Free: a holder proven dead has
nothing left to give notice to, so acquire seizes its lock without waiting at all.
Trait Implementations§
impl Eq for LockState
impl StructuralPartialEq for LockState
Auto Trait Implementations§
impl Freeze for LockState
impl RefUnwindSafe for LockState
impl Send for LockState
impl Sync for LockState
impl Unpin for LockState
impl UnsafeUnpin for LockState
impl UnwindSafe for LockState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.