pub struct LockManager { /* private fields */ }Expand description
Lock manager for coordinating transaction locks
Implementations§
Source§impl LockManager
impl LockManager
Sourcepub fn new(config: LockConfig) -> LockManager
pub fn new(config: LockConfig) -> LockManager
Create new lock manager
Sourcepub fn with_defaults() -> LockManager
pub fn with_defaults() -> LockManager
Create with default config
Sourcepub fn acquire(
&self,
txn_id: u64,
resource: &[u8],
mode: LockMode,
) -> LockResult
pub fn acquire( &self, txn_id: u64, resource: &[u8], mode: LockMode, ) -> LockResult
Acquire a lock
Sourcepub fn acquire_with_timeout(
&self,
txn_id: u64,
resource: &[u8],
mode: LockMode,
timeout: Duration,
) -> LockResult
pub fn acquire_with_timeout( &self, txn_id: u64, resource: &[u8], mode: LockMode, timeout: Duration, ) -> LockResult
Acquire lock with custom timeout
Sourcepub fn release_all(&self, txn_id: u64) -> usize
pub fn release_all(&self, txn_id: u64) -> usize
Release all locks for a transaction
Sourcepub fn holds_lock(&self, txn_id: u64, resource: &[u8]) -> Option<LockMode>
pub fn holds_lock(&self, txn_id: u64, resource: &[u8]) -> Option<LockMode>
Check if transaction holds lock on resource
Sourcepub fn get_locks(&self, txn_id: u64) -> Vec<(Vec<u8>, LockMode)>
pub fn get_locks(&self, txn_id: u64) -> Vec<(Vec<u8>, LockMode)>
Get all locks held by transaction
Sourcepub fn config(&self) -> &LockConfig
pub fn config(&self) -> &LockConfig
Get configuration
Trait Implementations§
Source§impl Default for LockManager
impl Default for LockManager
Source§fn default() -> LockManager
fn default() -> LockManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for LockManager
impl RefUnwindSafe for LockManager
impl Send for LockManager
impl Sync for LockManager
impl Unpin for LockManager
impl UnsafeUnpin for LockManager
impl UnwindSafe for LockManager
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request