pub struct BasicLocker { /* private fields */ }Expand description
A non-transactional locker.
Locks are released immediately when the cursor moves or closes. Does not support commit/abort semantics or write lock tracking for undo.
BasicLocker is used for non-transactional database operations where locks only need to be held for the duration of a single API call.
Implementations§
Source§impl BasicLocker
impl BasicLocker
Sourcepub fn new(id: i64, lock_manager: Arc<LockManager>) -> Self
pub fn new(id: i64, lock_manager: Arc<LockManager>) -> Self
Creates a new BasicLocker.
§Arguments
id- Unique locker ID (often a shared constant for all BasicLockers)lock_manager- Shared lock manager
Sourcepub fn with_timeout(
id: i64,
lock_manager: Arc<LockManager>,
timeout_ms: u64,
) -> Self
pub fn with_timeout( id: i64, lock_manager: Arc<LockManager>, timeout_ms: u64, ) -> Self
Creates a BasicLocker with a specified timeout.
Sourcepub fn with_no_wait(id: i64, lock_manager: Arc<LockManager>) -> Self
pub fn with_no_wait(id: i64, lock_manager: Arc<LockManager>) -> Self
Creates a BasicLocker with non-blocking mode.
Sourcepub fn register_cursor(&mut self, is_internal_db_cursor: bool)
pub fn register_cursor(&mut self, is_internal_db_cursor: bool)
Called by cursor open/init to configure whether locking is required.
Sets lockingRequired = !cursor.isInternalDbCursor(). Internal-DB cursors (e.g. the utilization
DB cursor) bypass the lock table entirely.
Sourcepub fn release_all_locks(&mut self) -> Result<(), TxnError>
pub fn release_all_locks(&mut self) -> Result<(), TxnError>
Release all locks held by this locker.
Called when the locker is closed or when a cursor moves.
Sourcepub fn set_lock_timeout(&mut self, timeout_ms: u64)
pub fn set_lock_timeout(&mut self, timeout_ms: u64)
Sets the lock timeout.
Sourcepub fn set_default_no_wait(&mut self, no_wait: bool)
pub fn set_default_no_wait(&mut self, no_wait: bool)
Sets the default no-wait mode.
Trait Implementations§
Source§impl Drop for BasicLocker
impl Drop for BasicLocker
Source§impl Locker for BasicLocker
impl Locker for BasicLocker
Source§fn lock(
&mut self,
lsn: u64,
lock_type: LockType,
non_blocking: bool,
) -> Result<LockResult, TxnError>
fn lock( &mut self, lsn: u64, lock_type: LockType, non_blocking: bool, ) -> Result<LockResult, TxnError>
Source§fn release_lock(&mut self, lsn: u64) -> Result<(), TxnError>
fn release_lock(&mut self, lsn: u64) -> Result<(), TxnError>
Source§fn owns_write_lock(&self, lsn: u64) -> bool
fn owns_write_lock(&self, lsn: u64) -> bool
Source§fn is_transactional(&self) -> bool
fn is_transactional(&self) -> bool
Source§fn lock_timeout_ms(&self) -> u64
fn lock_timeout_ms(&self) -> u64
Source§fn default_no_wait(&self) -> bool
fn default_no_wait(&self) -> bool
Source§fn locking_required(&self) -> bool
fn locking_required(&self) -> bool
Source§fn operation_end(&mut self) -> Result<(), TxnError>
fn operation_end(&mut self) -> Result<(), TxnError>
Source§fn release_non_txn_locks(&mut self) -> Result<(), TxnError>
fn release_non_txn_locks(&mut self) -> Result<(), TxnError>
Source§fn non_txn_operation_end(&mut self) -> Result<(), TxnError>
fn non_txn_operation_end(&mut self) -> Result<(), TxnError>
Source§fn close(&mut self)
fn close(&mut self)
Source§fn owns_any_lock(&self, lsn: u64) -> bool
fn owns_any_lock(&self, lsn: u64) -> bool
Source§fn retains_locks_on_commit(&self) -> bool
fn retains_locks_on_commit(&self) -> bool
Source§fn is_preemptable(&self) -> bool
fn is_preemptable(&self) -> bool
Source§fn is_importunate(&self) -> bool
fn is_importunate(&self) -> bool
Source§fn is_read_uncommitted_default(&self) -> bool
fn is_read_uncommitted_default(&self) -> bool
other_id. Read more