pub struct TxnLock<TxnId, T> { /* private fields */ }Implementations§
source§impl<TxnId: Display + Debug + Ord, T: Clone> TxnLock<TxnId, T>
impl<TxnId: Display + Debug + Ord, T: Clone> TxnLock<TxnId, T>
sourcepub async fn read(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuard<TxnId, T>, Error>
pub async fn read(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuard<TxnId, T>, Error>
Lock this value for reading at the given txn_id.
sourcepub fn try_read(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuard<TxnId, T>, Error>
pub fn try_read(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuard<TxnId, T>, Error>
Synchronously Lock this value for reading at the given txn_id, if possible.
sourcepub async fn read_exclusive(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuardExclusive<TxnId, T>, Error>
pub async fn read_exclusive(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuardExclusive<TxnId, T>, Error>
Lock this value for exclusive reading at the given txn_id.
sourcepub fn try_read_exclusive(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuardExclusive<TxnId, T>, Error>
pub fn try_read_exclusive(
&self,
txn_id: TxnId
) -> Result<TxnLockReadGuardExclusive<TxnId, T>, Error>
Synchronously lock this value for exclusive reading at the given txn_id, if possible.
sourcepub async fn write(&self, txn_id: TxnId) -> Result<TxnLockWriteGuard<T>, Error>
pub async fn write(&self, txn_id: TxnId) -> Result<TxnLockWriteGuard<T>, Error>
Lock this value for writing at the given txn_id.
sourcepub fn try_write(&self, txn_id: TxnId) -> Result<TxnLockWriteGuard<T>, Error>
pub fn try_write(&self, txn_id: TxnId) -> Result<TxnLockWriteGuard<T>, Error>
Synchronously lock this value for writing at the given txn_id, if possible.
source§impl<TxnId: Display + Ord, T: Clone> TxnLock<TxnId, T>
impl<TxnId: Display + Ord, T: Clone> TxnLock<TxnId, T>
sourcepub async fn commit(&self, txn_id: &TxnId) -> Arc<T>
pub async fn commit(&self, txn_id: &TxnId) -> Arc<T>
Commit the value of this TxnLock at the given txn_id.
This will wait until any earlier write locks have been committed or rolled back.
Panics:
- when called with a
txn_idwhich has already been finalized.