pub struct SsiManager { /* private fields */ }Expand description
Serializable Snapshot Isolation Manager
Provides serializable isolation level using SSI technique.
§Usage
ⓘ
let ssi = SsiManager::new();
// Begin transaction
let (txn_id, snapshot_ts) = ssi.begin()?;
// Read (records rw-dependency)
let value = ssi.read(txn_id, key)?;
// Write (checks write-write conflicts)
ssi.write(txn_id, key, value)?;
// Commit (checks for dangerous structures)
ssi.commit(txn_id)?;Implementations§
Source§impl SsiManager
impl SsiManager
Sourcepub fn record_read(
&self,
txn_id: TxnId,
key: &[u8],
) -> Result<(), SsiConflictError>
pub fn record_read( &self, txn_id: TxnId, key: &[u8], ) -> Result<(), SsiConflictError>
Record a read and check for rw-antidependencies
If another concurrent transaction wrote to this key after our snapshot, we have an rw-antidependency (T_reader →ʳʷ T_writer).
Sourcepub fn record_write(
&self,
txn_id: TxnId,
key: &[u8],
) -> Result<(), SsiConflictError>
pub fn record_write( &self, txn_id: TxnId, key: &[u8], ) -> Result<(), SsiConflictError>
Record a write and check for write-write conflicts
Uses first-updater-wins: if another transaction already wrote to this key after our snapshot, we must abort.
Sourcepub fn commit(&self, txn_id: TxnId) -> Result<Timestamp, SsiConflictError>
pub fn commit(&self, txn_id: TxnId) -> Result<Timestamp, SsiConflictError>
Commit a transaction
Checks for dangerous structures before allowing commit.
Sourcepub fn get_status(&self, txn_id: TxnId) -> Option<SsiTxnStatus>
pub fn get_status(&self, txn_id: TxnId) -> Option<SsiTxnStatus>
Get transaction status
Sourcepub fn get_snapshot_ts(&self, txn_id: TxnId) -> Option<Timestamp>
pub fn get_snapshot_ts(&self, txn_id: TxnId) -> Option<Timestamp>
Get snapshot timestamp for a transaction
Sourcepub fn is_visible(&self, txn_id: TxnId, version: &SsiVersionInfo) -> bool
pub fn is_visible(&self, txn_id: TxnId, version: &SsiVersionInfo) -> bool
Check if a version is visible to a transaction
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SsiManager
impl !RefUnwindSafe for SsiManager
impl !UnwindSafe for SsiManager
impl Send for SsiManager
impl Sync for SsiManager
impl Unpin for SsiManager
impl UnsafeUnpin for SsiManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more