pub struct RwDatabaseLock { /* private fields */ }Expand description
Reader-Writer database lock for concurrent read access
Implements a shared-exclusive lock protocol:
- Multiple concurrent readers allowed
- Single exclusive writer
- Writer intent prevents reader starvation
Implementations§
Source§impl RwDatabaseLock
impl RwDatabaseLock
Acquire a shared (read-only) lock
Multiple processes can hold shared locks simultaneously. Blocks if a writer is active or waiting.
Sourcepub fn acquire_exclusive<P: AsRef<Path>>(db_path: P) -> Result<Self, LockError>
pub fn acquire_exclusive<P: AsRef<Path>>(db_path: P) -> Result<Self, LockError>
Acquire an exclusive (read-write) lock
Only one process can hold an exclusive lock. Blocks if any readers or another writer is active.
Sourcepub fn acquire_with_mode<P: AsRef<Path>>(
db_path: P,
mode: ConnectionMode,
config: &LockConfig,
) -> Result<Self, LockError>
pub fn acquire_with_mode<P: AsRef<Path>>( db_path: P, mode: ConnectionMode, config: &LockConfig, ) -> Result<Self, LockError>
Acquire lock with specified mode and configuration
Sourcepub fn mode(&self) -> ConnectionMode
pub fn mode(&self) -> ConnectionMode
Get connection mode
Sourcepub fn is_readonly(&self) -> bool
pub fn is_readonly(&self) -> bool
Check if this is a read-only connection
Trait Implementations§
Source§impl Drop for RwDatabaseLock
impl Drop for RwDatabaseLock
Auto Trait Implementations§
impl Freeze for RwDatabaseLock
impl RefUnwindSafe for RwDatabaseLock
impl Send for RwDatabaseLock
impl Sync for RwDatabaseLock
impl Unpin for RwDatabaseLock
impl UnsafeUnpin for RwDatabaseLock
impl UnwindSafe for RwDatabaseLock
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more