Struct concread::bptree::BptreeMap[][src]

pub struct BptreeMap<K, V> where
    K: Ord + Clone + Debug + Sync + Send + 'static,
    V: Clone + Sync + Send + 'static, 
{ /* fields omitted */ }

A concurrently readable map based on a modified B+Tree structure.

This structure can be used in locations where you would otherwise us RwLock<BTreeMap> or Mutex<BTreeMap>.

Generally, the concurrent HashMap is a better choice unless you require ordered key storage.

This is a concurrently readable structure, meaning it has transactional properties. Writers are serialised (one after the other), and readers can exist in parallel with stable views of the structure at a point in time.

This is achieved through the use of COW or MVCC. As a write occurs subsets of the tree are cloned into the writer thread and then commited later. This may cause memory usage to increase in exchange for a gain in concurrent behaviour.

Transactions can be rolled-back (aborted) without penalty by dropping the BptreeMapWriteTxn without calling commit().

Implementations

impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> BptreeMap<K, V>[src]

pub fn new() -> Self[src]

Construct a new concurrent tree

pub fn read(&self) -> BptreeMapReadTxn<'_, K, V>[src]

Initiate a read transaction for the tree, concurrent to any other readers or writers.

pub fn write(&self) -> BptreeMapWriteTxn<'_, K, V>[src]

Initiate a write transaction for the tree, exclusive to this writer, and concurrently to all existing reads.

pub fn try_write(&self) -> Option<BptreeMapWriteTxn<'_, K, V>>[src]

Attempt to create a new write, returns None if another writer already exists.

Trait Implementations

impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> Default for BptreeMap<K, V>[src]

impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> FromIterator<(K, V)> for BptreeMap<K, V>[src]

impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> Send for BptreeMap<K, V>[src]

impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> Sync for BptreeMap<K, V>[src]

Auto Trait Implementations

impl<K, V> !RefUnwindSafe for BptreeMap<K, V>

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,