pub trait CommitLock: Debug {
type Lease: CommitLease;
// Required method
fn lock<'life0, 'async_trait>(
&'life0 self,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::Lease, CommitError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A commit implementation that uses a lock to prevent conflicting writes.
Required Associated Types§
type Lease: CommitLease
Required Methods§
Sourcefn lock<'life0, 'async_trait>(
&'life0 self,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::Lease, CommitError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lock<'life0, 'async_trait>(
&'life0 self,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::Lease, CommitError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Attempt to lock the table for the given version.
If it is already locked by another transaction, wait until it is unlocked. Once it is unlocked, return CommitError::CommitConflict if the version has already been committed. Otherwise, return the lock.
To prevent poisoned locks, it’s recommended to set a timeout on the lock of at least 30 seconds.
It is not required that the lock tracks the version. It is provided in case the locking is handled by a catalog service that needs to know the current version of the table.