pub struct SharedVersionedChain<T: Copy + 'static> { /* private fields */ }Implementations§
pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, ChainError>
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, ChainError>
pub fn capacity(&self) -> usize
Sourcepub fn clear(&self)
pub fn clear(&self)
Reset to empty: head -> NIL, live_count -> 0, free list rebuilt
to contain all slots. Stale version values referring to old
snapshots become invalid. Not thread-safe with concurrent
push/read from other threads.
pub fn header(&self) -> &ChainHeader
Sourcepub fn push(&self, version: u64, value: T) -> Result<(), ChainError>
pub fn push(&self, version: u64, value: T) -> Result<(), ChainError>
Push a new version at the head. version must be strictly
greater than the current head’s version (MVCC invariant).
Sourcepub fn read_at(&self, snapshot_version: u64) -> Option<T>
pub fn read_at(&self, snapshot_version: u64) -> Option<T>
Read the value visible at snapshot_version. Walks back from
head through the chain until a node with version <= snapshot
is found. Returns None if no such version exists.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn flush(&self) -> Result<(), ChainError>
Sourcepub fn flush_async(&self) -> Result<(), ChainError>
pub fn flush_async(&self) -> Result<(), ChainError>
Non-blocking flush: schedules a writeback via the OS. Note: Windows is only partially async (sync to page cache, not to disk).
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
Auto Trait Implementations§
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