pub struct ArenaWriteSet { /* private fields */ }Expand description
MVCC write-set using 128-bit fingerprints instead of Vec
§Memory Comparison
| Structure | Per-entry Memory | 1000 entries |
|---|---|---|
| HashSet<Vec | 24 + heap (~50B) | ~74 KB |
| HashSet | 16 bytes | 16 KB |
| Savings | ~70% | ~58 KB |
§Operations
- Insert: O(1) with no allocation
- Contains: O(1) with pre-computed hash
- is_disjoint: O(min(n,m)) where n,m are set sizes
Implementations§
Source§impl ArenaWriteSet
impl ArenaWriteSet
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with expected capacity
Sourcepub fn insert(&mut self, fingerprint: KeyFingerprint) -> bool
pub fn insert(&mut self, fingerprint: KeyFingerprint) -> bool
Insert a key fingerprint
Sourcepub fn insert_bytes(&mut self, key: &[u8]) -> bool
pub fn insert_bytes(&mut self, key: &[u8]) -> bool
Insert from raw bytes
Sourcepub fn contains(&self, fingerprint: &KeyFingerprint) -> bool
pub fn contains(&self, fingerprint: &KeyFingerprint) -> bool
Check if a key is in the write set
Sourcepub fn contains_bytes(&self, key: &[u8]) -> bool
pub fn contains_bytes(&self, key: &[u8]) -> bool
Check if write set contains key by bytes
Sourcepub fn is_disjoint(&self, other: &ArenaWriteSet) -> bool
pub fn is_disjoint(&self, other: &ArenaWriteSet) -> bool
Check if two write sets are disjoint (no common keys)
Sourcepub fn iter(&self) -> impl Iterator<Item = &KeyFingerprint>
pub fn iter(&self) -> impl Iterator<Item = &KeyFingerprint>
Iterate over fingerprints
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArenaWriteSet
impl RefUnwindSafe for ArenaWriteSet
impl Send for ArenaWriteSet
impl Sync for ArenaWriteSet
impl Unpin for ArenaWriteSet
impl UnsafeUnpin for ArenaWriteSet
impl UnwindSafe for ArenaWriteSet
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