pub struct LockFreeMemTable { /* private fields */ }Expand description
Lock-free memtable with hazard pointer protection
Implementations§
Source§impl LockFreeMemTable
impl LockFreeMemTable
Sourcepub fn read(
&self,
key: &[u8],
snapshot_ts: u64,
txn_id: Option<u64>,
) -> Option<Vec<u8>>
pub fn read( &self, key: &[u8], snapshot_ts: u64, txn_id: Option<u64>, ) -> Option<Vec<u8>>
Read a value at snapshot timestamp
This is a lock-free read protected by hazard pointers. Returns a cloned value for safety across hazard pointer boundaries.
Sourcepub fn read_with<F, R>(
&self,
key: &[u8],
snapshot_ts: u64,
txn_id: Option<u64>,
f: F,
) -> Option<R>
pub fn read_with<F, R>( &self, key: &[u8], snapshot_ts: u64, txn_id: Option<u64>, f: F, ) -> Option<R>
Read a value at snapshot timestamp with zero-copy callback
This is an optimized read path that avoids cloning for inline values. The callback receives a reference to the value, avoiding allocation.
§Arguments
key- The key to readsnapshot_ts- Snapshot timestamp for visibilitytxn_id- Current transaction ID (to see own uncommitted writes)f- Callback that receives the value reference
§Returns
The result of the callback, or None if key not found
Sourcepub fn write(
&self,
key: Vec<u8>,
value: Option<Vec<u8>>,
txn_id: u64,
) -> Result<()>
pub fn write( &self, key: Vec<u8>, value: Option<Vec<u8>>, txn_id: u64, ) -> Result<()>
Write a value (creates uncommitted version)
Sourcepub fn commit(&self, txn_id: u64, commit_ts: u64, keys: &[Vec<u8>])
pub fn commit(&self, txn_id: u64, commit_ts: u64, keys: &[Vec<u8>])
Commit a transaction’s writes
Sourcepub fn has_write_conflict(&self, key: &[u8], txn_id: u64) -> bool
pub fn has_write_conflict(&self, key: &[u8], txn_id: u64) -> bool
Check for write conflict
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get approximate size in bytes
Trait Implementations§
Source§impl Default for LockFreeMemTable
impl Default for LockFreeMemTable
impl Send for LockFreeMemTable
impl Sync for LockFreeMemTable
Auto Trait Implementations§
impl !Freeze for LockFreeMemTable
impl !RefUnwindSafe for LockFreeMemTable
impl Unpin for LockFreeMemTable
impl UnwindSafe for LockFreeMemTable
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> 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