pub struct VersionChain { /* private fields */ }Expand description
Chain of versions for a single key, sorted by commit_ts descending
Optimized for:
- O(log V) reads via binary search
- O(1) writes (prepend to front)
- O(V) GC (linear scan with compaction)
§Rec 11: Consolidated
Delegates binary-search logic to BinarySearchChain<VersionEntry> from
sochdb-core, eliminating duplication with durable_storage::VersionChain.
Implementations§
Source§impl VersionChain
impl VersionChain
Sourcepub fn add_uncommitted(
&mut self,
value: Option<Vec<u8>>,
txn_id: u64,
epoch: u32,
)
pub fn add_uncommitted( &mut self, value: Option<Vec<u8>>, txn_id: u64, epoch: u32, )
Add uncommitted version
Sourcepub fn read_at(
&self,
snapshot_ts: u64,
current_txn_id: Option<u64>,
) -> Option<&VersionEntry>
pub fn read_at( &self, snapshot_ts: u64, current_txn_id: Option<u64>, ) -> Option<&VersionEntry>
Read at snapshot timestamp
Complexity: O(log V) via binary search
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 a write conflict
Trait Implementations§
Source§impl Debug for VersionChain
impl Debug for VersionChain
Source§impl Default for VersionChain
impl Default for VersionChain
Source§fn default() -> VersionChain
fn default() -> VersionChain
Returns the “default value” for a type. Read more
Source§impl MvccVersionChain for VersionChain
impl MvccVersionChain for VersionChain
Source§fn get_visible(&self, ctx: &VisibilityContext) -> Option<&Self::Value>
fn get_visible(&self, ctx: &VisibilityContext) -> Option<&Self::Value>
Get the visible version for the given context
Source§fn get_latest(&self) -> Option<&Self::Value>
fn get_latest(&self) -> Option<&Self::Value>
Get the latest version (regardless of visibility)
Source§fn version_count(&self) -> usize
fn version_count(&self) -> usize
Number of versions in the chain
Source§impl MvccVersionChainMut for VersionChain
impl MvccVersionChainMut for VersionChain
Source§impl WriteConflictDetection for VersionChain
impl WriteConflictDetection for VersionChain
Source§fn has_write_conflict(&self, txn_id: TxnId) -> bool
fn has_write_conflict(&self, txn_id: TxnId) -> bool
Check if there’s a write-write conflict with another transaction
Auto Trait Implementations§
impl Freeze for VersionChain
impl RefUnwindSafe for VersionChain
impl Send for VersionChain
impl Sync for VersionChain
impl Unpin for VersionChain
impl UnsafeUnpin for VersionChain
impl UnwindSafe for VersionChain
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