pub struct StoreLock { /* private fields */ }Expand description
A held store-wide lock (see store_lock_path). Released on drop.
Processes that use the database (daemon, shell) hold a StoreLock::shared guard for as long
as they keep connections open; replace_database takes the StoreLock::exclusive guard,
so a replace runs only when no cooperating process is using the store. The lock is advisory
and cooperative: a process that never takes the shared guard is not excluded.
Implementations§
Source§impl StoreLock
impl StoreLock
Shared guard: any number of holders, excluded only by an exclusive holder. Waits per
options.timeout and returns DbError::Fs (locked or timed out) when busy.
Sourcepub fn exclusive(db_path: &Path, options: &LockOptions) -> Result<Self>
pub fn exclusive(db_path: &Path, options: &LockOptions) -> Result<Self>
Exclusive guard: excludes every shared and exclusive holder. Waits per options.timeout.
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