pub struct SsiTransaction {
pub txn_id: TxnId,
pub start_ts: Timestamp,
pub status: SsiTxnStatus,
pub commit_ts: Option<Timestamp>,
pub read_set: HashSet<InlineKey>,
pub write_set: HashSet<InlineKey>,
pub in_rw_deps: HashSet<TxnId>,
pub out_rw_deps: HashSet<TxnId>,
pub has_committed_in_rw: bool,
pub has_committed_out_rw: bool,
/* private fields */
}Expand description
Transaction entry for SSI tracking
Fields§
§txn_id: TxnIdTransaction ID
start_ts: TimestampStart timestamp (snapshot time)
status: SsiTxnStatusStatus
commit_ts: Option<Timestamp>Commit timestamp (if committed)
read_set: HashSet<InlineKey>Read set (keys this transaction has read) — uses InlineKey (SmallVec<[u8; 32]>) to avoid heap allocation for keys ≤ 32 bytes
write_set: HashSet<InlineKey>Write set (keys this transaction has written) — uses InlineKey for inline storage
in_rw_deps: HashSet<TxnId>Incoming rw-antidependencies (transactions that read before this wrote)
out_rw_deps: HashSet<TxnId>Outgoing rw-antidependencies (transactions that wrote after this read)
has_committed_in_rw: boolFlag: has incoming from committed transaction
has_committed_out_rw: boolFlag: has outgoing to committed transaction
Implementations§
Source§impl SsiTransaction
impl SsiTransaction
Sourcepub fn record_read(&mut self, key: &[u8])
pub fn record_read(&mut self, key: &[u8])
Record a read operation (stack-allocated for keys ≤ 32 bytes)
Sourcepub fn record_write(&mut self, key: &[u8])
pub fn record_write(&mut self, key: &[u8])
Record a write operation (stack-allocated for keys ≤ 32 bytes)
Sourcepub fn maybe_read(&self, key: &[u8]) -> bool
pub fn maybe_read(&self, key: &[u8]) -> bool
Fast Bloom pre-check: might this transaction have read key?
False positives possible, false negatives are not.
Sourcepub fn is_dangerous(&self) -> bool
pub fn is_dangerous(&self) -> bool
Check for dangerous structure (two-in-two-out)
A transaction is part of a dangerous structure if it has:
- At least one incoming rw-antidep from a committed txn, AND
- At least one outgoing rw-antidep to a committed txn
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SsiTransaction
impl RefUnwindSafe for SsiTransaction
impl Send for SsiTransaction
impl Sync for SsiTransaction
impl Unpin for SsiTransaction
impl UnsafeUnpin for SsiTransaction
impl UnwindSafe for SsiTransaction
Blanket Implementations§
impl<T> Allocation for T
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
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>
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>
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