pub struct StoreLock { /* private fields */ }Expand description
Exclusive writer lock represented by a restrictive sidecar file.
Implementations§
Source§impl StoreLock
impl StoreLock
Sourcepub fn acquire(
database_path: &Path,
stale_after: Duration,
) -> Result<Self, StoreError>
pub fn acquire( database_path: &Path, stale_after: Duration, ) -> Result<Self, StoreError>
Acquires an exclusive writer lock and recovers an expired lock once.
The sidecar path is the database path with .lock appended to its extension. On Unix it
is created with mode 0600. Dropping the returned guard removes only a lock whose token
still matches this owner.
§Errors
Returns StoreError::LockHeld for an active lock or StoreError::Io when lock
metadata cannot be created, inspected, or replaced.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StoreLock
impl RefUnwindSafe for StoreLock
impl Send for StoreLock
impl Sync for StoreLock
impl Unpin for StoreLock
impl UnsafeUnpin for StoreLock
impl UnwindSafe for StoreLock
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