pub struct LockTable { /* private fields */ }Expand description
The row-lock table. Keyed on stable (RelId, RowId); carries the
wait-for graph used for deadlock detection.
Clone to match the engine’s other transient concurrency state
(active_writer_versions) that rides on Engine; the shared
(non-cloned) lock manager is Phase C.5, when the single engine lock
is split.
Implementations§
Source§impl LockTable
impl LockTable
pub fn new() -> Self
Sourcepub fn acquire(
&mut self,
rel: RelId,
row: RowId,
mode: LockMode,
version: u64,
policy: WaitPolicy,
) -> LockOutcome
pub fn acquire( &mut self, rel: RelId, row: RowId, mode: LockMode, version: u64, policy: WaitPolicy, ) -> LockOutcome
Try to acquire mode on (rel, row) for transaction
version. Re-locking a row this version already holds upgrades
in place (idempotent for equal-or-weaker modes).
Sourcepub fn release_all(&mut self, version: u64)
pub fn release_all(&mut self, version: u64)
Release every lock + wait held by version (transaction end:
commit or abort). Removes it from all entries and the wait-for
graph, and drops now-empty entries.
Sourcepub fn locked_row_count(&self) -> usize
pub fn locked_row_count(&self) -> usize
Number of rows with at least one holder or waiter. For
pg_locks enumeration (Phase C.4) and tests.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LockTable
impl RefUnwindSafe for LockTable
impl Send for LockTable
impl Sync for LockTable
impl Unpin for LockTable
impl UnsafeUnpin for LockTable
impl UnwindSafe for LockTable
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