pub enum LockMode {
Default,
ReadUncommitted,
ReadCommitted,
Rmw,
}Expand description
Lock mode for read operations.
Specifies the locking behavior for a read operation. Controls isolation level and whether locks are acquired.
Variants§
Default
Use the default isolation level for the cursor or transaction.
For transactional operations, this is typically read-committed. For non-transactional operations, this is read-uncommitted.
ReadUncommitted
Read without acquiring locks (dirty reads).
Reads may return data that is currently being modified by another transaction and may be rolled back. Provides maximum concurrency but minimal isolation.
ReadCommitted
Read with read-committed isolation.
A read lock is acquired but released when the cursor moves or the read operation completes. Prevents dirty reads but allows non-repeatable reads.
Rmw
Read-modify-write: acquire write lock on read.
Acquires a write lock immediately, even though the operation is a read. Use this when you intend to modify the record after reading it, to avoid deadlocks caused by lock upgrades.
Implementations§
Source§impl LockMode
impl LockMode
Sourcepub fn allows_dirty_reads(&self) -> bool
pub fn allows_dirty_reads(&self) -> bool
Returns whether this mode allows dirty reads.
Sourcepub fn acquires_write_lock(&self) -> bool
pub fn acquires_write_lock(&self) -> bool
Returns whether this mode acquires a write lock.
Sourcepub fn is_read_committed(&self) -> bool
pub fn is_read_committed(&self) -> bool
Returns whether this mode provides read-committed isolation.
Trait Implementations§
impl Copy for LockMode
impl Eq for LockMode
impl StructuralPartialEq for LockMode
Auto Trait Implementations§
impl Freeze for LockMode
impl RefUnwindSafe for LockMode
impl Send for LockMode
impl Sync for LockMode
impl Unpin for LockMode
impl UnsafeUnpin for LockMode
impl UnwindSafe for LockMode
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.