pub struct SharedTreiberStack<T: Copy + 'static> { /* private fields */ }Implementations§
Sourcepub fn create(
path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, StackError>
pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, StackError>
Obtain the stack at path, initializing an empty one if the
path does not yet exist and attaching to it if it does.
Attaching leaves pushed entries and the free list in place; a
region built with a different capacity or payload type is a
LayoutMismatch. reset reinitializes.
Sourcepub fn reset(
path: impl AsRef<Path>,
capacity: usize,
) -> Result<Self, StackError>
pub fn reset( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, StackError>
Truncate the stack at path and initialize an empty one,
discarding every entry live peers share. For a caller that
knows it owns the path.
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, StackError>
pub fn capacity(&self) -> usize
Sourcepub fn push(&self, value: T) -> Result<(), StackError>
pub fn push(&self, value: T) -> Result<(), StackError>
Push a value onto the stack.
Sourcepub fn approx_len(&self) -> usize
pub fn approx_len(&self) -> usize
Approximate len: walks the linked list from head. O(N). Subject to race with concurrent push/pop.
pub fn flush(&self) -> Result<(), StackError>
pub fn flush_async(&self) -> Result<(), StackError>
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