Skip to main content

SharedBTreeMap

Struct SharedBTreeMap 

Source
pub struct SharedBTreeMap<K: Copy + Ord + Default + 'static, V: Copy + Default + 'static> { /* private fields */ }

Implementations§

Source§

impl<K: Copy + Ord + Default + 'static, V: Copy + Default + 'static> SharedBTreeMap<K, V>

Source

pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, BTreeError>

Source

pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, BTreeError>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn capacity(&self) -> usize

Source

pub fn node_count(&self) -> usize

Number of nodes bump-allocated so far (resident-memory witness: node_count() * size_of::<BTreeNode>()).

Source

pub fn get(&self, key: &K) -> Option<V>

Look up key. Lock-free read against a quiescent tree.

Source

pub fn contains_key(&self, key: &K) -> bool

True if key is present.

Source

pub fn insert(&self, key: K, value: V) -> Result<Option<V>, BTreeError>

Insert / update. Single-writer (serialise externally). Returns the previous value if key was present.

Source

pub fn remove(&self, key: &K) -> Result<Option<V>, BTreeError>

Remove key, returning its previous value if present. Single-writer (serialise externally, as with insert).

Source

pub fn first(&self) -> Option<(K, V)>

Smallest (key, value) in the map, or None if empty.

Source

pub fn iter_ascending(&self) -> Vec<(K, V)>

Collect all (K, V) in ascending key order (validation / iteration).

Source

pub fn flush(&self) -> Result<(), BTreeError>

Trait Implementations§

Source§

impl<K: Copy + Ord + Default + Send + Sync + 'static, V: Copy + Default + Send + Sync + 'static> AdaptiveInstance for SharedBTreeMap<K, V>

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

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.
Source§

impl<K: Copy + Ord + Default + Send + 'static, V: Copy + Default + Send + 'static> Send for SharedBTreeMap<K, V>

Source§

impl<K: Copy + Ord + Default + Sync + 'static, V: Copy + Default + Sync + 'static> Sync for SharedBTreeMap<K, V>

Auto Trait Implementations§

§

impl<K, V> !Freeze for SharedBTreeMap<K, V>

§

impl<K, V> !UnwindSafe for SharedBTreeMap<K, V>

§

impl<K, V> RefUnwindSafe for SharedBTreeMap<K, V>

§

impl<K, V> Unpin for SharedBTreeMap<K, V>

§

impl<K, V> UnsafeUnpin for SharedBTreeMap<K, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.