pub struct Lock { /* private fields */ }Expand description
Locks a stable coordination inode, never a replaceable JSON document.
Implementations§
Source§impl Lock
impl Lock
Sourcepub fn acquire(path: &Path, shared: bool) -> Result<Lock, Problem>
pub fn acquire(path: &Path, shared: bool) -> Result<Lock, Problem>
Compatibility entry point; new callers can make the mode explicit.
Sourcepub fn acquire_mode(path: &Path, mode: LockMode) -> Result<Lock, Problem>
pub fn acquire_mode(path: &Path, mode: LockMode) -> Result<Lock, Problem>
Acquire the requested OS lock mode.
Sourcepub fn read_existing(path: &Path) -> Result<Lock, Problem>
pub fn read_existing(path: &Path) -> Result<Lock, Problem>
Shared admission on an existing gate, without creating files or requiring write access.
Sourcepub fn wait_existing(path: &Path, mode: LockMode) -> Result<Lock, Problem>
pub fn wait_existing(path: &Path, mode: LockMode) -> Result<Lock, Problem>
Initializers can race to open the same freshly published gate. Wait for the winner to finish before comparing its layout with the requested one.
Sourcepub async fn wait_existing_with_control(
path: &Path,
mode: LockMode,
control: &Control,
) -> Result<Lock, Problem>
pub async fn wait_existing_with_control( path: &Path, mode: LockMode, control: &Control, ) -> Result<Lock, Problem>
Wait for an existing lock while observing cancellation.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Lock
impl Freeze for Lock
impl Move for Lock
impl RefUnwindSafe for Lock
impl Send for Lock
impl Sync for Lock
impl Unpin for Lock
impl UnsafeUnpin for Lock
impl UnwindSafe for Lock
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