pub struct LockFreeVersion {
pub storage: ValueStorage,
pub txn_id: u64,
pub commit_ts: AtomicU64,
pub next: AtomicPtr<LockFreeVersion>,
}Expand description
Version of a key-value pair for lock-free access
Uses inline storage for small values to eliminate heap allocation and improve cache locality. Most database values (80%+) fit inline.
Fields§
§storage: ValueStorageThe value with optimized inline storage
txn_id: u64Transaction that created this version
commit_ts: AtomicU64Commit timestamp (0 = uncommitted)
next: AtomicPtr<LockFreeVersion>Next version in chain (older)
Implementations§
Source§impl LockFreeVersion
impl LockFreeVersion
Sourcepub fn new_from_slice(value: Option<&[u8]>, txn_id: u64) -> Self
pub fn new_from_slice(value: Option<&[u8]>, txn_id: u64) -> Self
Create a new uncommitted version with value slice (zero-copy for inline)
Sourcepub fn new(value: Option<Vec<u8>>, txn_id: u64) -> Self
pub fn new(value: Option<Vec<u8>>, txn_id: u64) -> Self
Create a new uncommitted version (legacy API - accepts owned Vec)
Sourcepub fn value_cloned(&self) -> Option<Vec<u8>>
pub fn value_cloned(&self) -> Option<Vec<u8>>
Get the value as owned Vec (for compatibility)
Note: Prefer get_value() to avoid allocation
Sourcepub fn is_committed(&self) -> bool
pub fn is_committed(&self) -> bool
Check if committed
Sourcepub fn get_commit_ts(&self) -> u64
pub fn get_commit_ts(&self) -> u64
Get commit timestamp
Sourcepub fn set_commit_ts(&self, ts: u64)
pub fn set_commit_ts(&self, ts: u64)
Set commit timestamp
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LockFreeVersion
impl RefUnwindSafe for LockFreeVersion
impl Send for LockFreeVersion
impl Sync for LockFreeVersion
impl Unpin for LockFreeVersion
impl UnsafeUnpin for LockFreeVersion
impl UnwindSafe for LockFreeVersion
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