pub struct LockManager { /* private fields */ }Expand description
Lock manager for coordinating transaction locks
Implementations§
Source§impl LockManager
impl LockManager
Sourcepub fn new(config: LockConfig) -> Self
pub fn new(config: LockConfig) -> Self
Create new lock manager
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default config
Sourcepub fn acquire(
&self,
txn_id: TxnId,
resource: &[u8],
mode: LockMode,
) -> LockResult
pub fn acquire( &self, txn_id: TxnId, resource: &[u8], mode: LockMode, ) -> LockResult
Acquire a lock
Sourcepub fn acquire_with_timeout(
&self,
txn_id: TxnId,
resource: &[u8],
mode: LockMode,
timeout: Duration,
) -> LockResult
pub fn acquire_with_timeout( &self, txn_id: TxnId, resource: &[u8], mode: LockMode, timeout: Duration, ) -> LockResult
Acquire lock with custom timeout
Sourcepub fn release_all(&self, txn_id: TxnId) -> usize
pub fn release_all(&self, txn_id: TxnId) -> usize
Release all locks for a transaction
Sourcepub fn holds_lock(&self, txn_id: TxnId, resource: &[u8]) -> Option<LockMode>
pub fn holds_lock(&self, txn_id: TxnId, resource: &[u8]) -> Option<LockMode>
Check if transaction holds lock on resource
Sourcepub fn get_locks(&self, txn_id: TxnId) -> Vec<(Vec<u8>, LockMode)>
pub fn get_locks(&self, txn_id: TxnId) -> Vec<(Vec<u8>, LockMode)>
Get all locks held by transaction
Sourcepub fn config(&self) -> &LockConfig
pub fn config(&self) -> &LockConfig
Get configuration
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LockManager
impl Forget for LockManager
impl Move for LockManager
impl RefUnwindSafe for LockManagerwhere
RwLock<HashMap<Vec<u8>, Lock>>: RefUnwindSafe,
RwLock<HashMap<u64, HashSet<Vec<u8>>>>: RefUnwindSafe,
RwLock<HashMap<u64, HashSet<u64>>>: RefUnwindSafe,
Condvar: RefUnwindSafe,
Mutex<()>: RefUnwindSafe,
RwLock<LockStats>: RefUnwindSafe,
impl Send for LockManager
impl Sync for LockManager
impl Unpin for LockManager
impl UnsafeUnpin for LockManagerwhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(Vec<u8>, Lock)>: UnsafeUnpin,
PhantomData<(u64, HashSet<Vec<u8>>)>: UnsafeUnpin,
PhantomData<(u64, HashSet<u64>)>: UnsafeUnpin,
impl UnwindSafe for LockManagerwhere
RwLock<HashMap<Vec<u8>, Lock>>: UnwindSafe,
RwLock<HashMap<u64, HashSet<Vec<u8>>>>: UnwindSafe,
RwLock<HashMap<u64, HashSet<u64>>>: UnwindSafe,
Condvar: UnwindSafe,
Mutex<()>: UnwindSafe,
RwLock<LockStats>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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