pub struct Transaction {
pub id: TxnId,
pub state: TxnState,
pub start_ts: u64,
pub commit_ts: Option<u64>,
pub writes: Vec<TxnWrite>,
pub read_set: HashSet<TxnRead>,
pub isolation: IsolationLevel,
}Expand description
Transaction handle for the user
Fields§
§id: TxnIdUnique transaction ID
state: TxnStateTransaction state
start_ts: u64Start timestamp for MVCC
commit_ts: Option<u64>Commit timestamp (set on commit)
writes: Vec<TxnWrite>Buffered writes
read_set: HashSet<TxnRead>Read set for conflict detection
isolation: IsolationLevelIsolation level
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(id: TxnId, start_ts: u64, isolation: IsolationLevel) -> Self
pub fn new(id: TxnId, start_ts: u64, isolation: IsolationLevel) -> Self
Create a new transaction
Sourcepub fn record_read(&mut self, table: &str, key: Vec<u8>)
pub fn record_read(&mut self, table: &str, key: Vec<u8>)
Record a read for conflict detection
Sourcepub fn get_local(&self, table: &str, key: &[u8]) -> Option<&TxnWrite>
pub fn get_local(&self, table: &str, key: &[u8]) -> Option<&TxnWrite>
Check for read-your-writes
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Check if transaction has any writes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
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
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