pub struct LockRequest {
pub txn_id: u64,
pub mode: LockMode,
pub deadline: Option<Instant>,
pub control: ExecutionControl,
pub priority: Option<u64>,
}Expand description
One lock acquisition request.
The four fields the spec’s wait queue carries — transaction ID, deadline,
cancellation control, lock mode — are all here; priority is
victim-selection input and never enters the queue itself.
Fields§
§txn_id: u64The requesting transaction. u64 today; see the module docs for the
128-bit mongreldb_types::ids::TransactionId migration note.
mode: LockModeThe requested mode.
deadline: Option<Instant>Optional lock-wait deadline, independent of any deadline inside
control. Expiry fails the wait with LockError::DeadlineExceeded.
control: ExecutionControlCooperative cancellation control; cancelling it fails the wait with
LockError::Cancelled (or LockError::DeadlineExceeded when the
control’s own deadline fired first), observed within
[CANCELLATION_POLL_INTERVAL].
priority: Option<u64>Optional deadlock-victim priority: within one wait-for cycle the
lowest priority value dies first, ties break by youngest transaction.
None is [DEFAULT_PRIORITY].
Implementations§
Source§impl LockRequest
impl LockRequest
Sourcepub fn new(txn_id: u64, mode: LockMode, control: ExecutionControl) -> Self
pub fn new(txn_id: u64, mode: LockMode, control: ExecutionControl) -> Self
A request with no lock-wait deadline and no explicit priority.
Sourcepub fn with_deadline(self, deadline: Instant) -> Self
pub fn with_deadline(self, deadline: Instant) -> Self
Sets the lock-wait deadline.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the lock-wait deadline relative to now. Overflowing timeouts
collapse to an already-expired deadline (fail closed), matching
ExecutionControl::with_timeout.
Sourcepub fn with_priority(self, priority: u64) -> Self
pub fn with_priority(self, priority: u64) -> Self
Sets the deadlock-victim priority (lower values die first).
Trait Implementations§
Source§impl Clone for LockRequest
impl Clone for LockRequest
Source§fn clone(&self) -> LockRequest
fn clone(&self) -> LockRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LockRequest
impl !UnwindSafe for LockRequest
impl Freeze for LockRequest
impl Send for LockRequest
impl Sync for LockRequest
impl Unpin for LockRequest
impl UnsafeUnpin for LockRequest
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<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>
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>
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