pub struct LockFreeVersionChain { /* private fields */ }Expand description
Lock-free version chain using fat-node grouping (Rec 2)
Instead of a singly-linked list of individual versions, versions are grouped into fat nodes of 8. This reduces pointer chases from O(v) to O(v/8) since scanning 8 slots within a fat node hits the same cache line.
Implementations§
Source§impl LockFreeVersionChain
impl LockFreeVersionChain
Sourcepub fn add_uncommitted(&self, value: Option<Vec<u8>>, txn_id: u64) -> Result<()>
pub fn add_uncommitted(&self, value: Option<Vec<u8>>, txn_id: u64) -> Result<()>
Add a new uncommitted version
Returns error if there’s already an uncommitted version from another txn
Sourcepub fn read_at(
&self,
snapshot_ts: u64,
current_txn_id: Option<u64>,
) -> Option<&LockFreeVersion>
pub fn read_at( &self, snapshot_ts: u64, current_txn_id: Option<u64>, ) -> Option<&LockFreeVersion>
Read at a snapshot timestamp
Returns the most recent committed version visible at snapshot_ts, or an uncommitted version if it belongs to current_txn_id.
Sourcepub fn has_write_conflict(&self, my_txn_id: u64) -> bool
pub fn has_write_conflict(&self, my_txn_id: u64) -> bool
Check if there’s an uncommitted version by another transaction
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LockFreeVersionChain
impl RefUnwindSafe for LockFreeVersionChain
impl Send for LockFreeVersionChain
impl Sync for LockFreeVersionChain
impl Unpin for LockFreeVersionChain
impl UnsafeUnpin for LockFreeVersionChain
impl UnwindSafe for LockFreeVersionChain
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
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