Skip to main content

Crate b_link

Crate b_link 

Source
Expand description

Concurrent ordered map and set collections implemented as a B-link tree.

BLinkMap and BLinkSet use per-page read/write latches, two-sided fences, right-sibling links, and forwarding pages. Readers correct stale routes while concurrent writers split, rotate, merge, and unlink pages.

Entry lookups return EntryRef or EntryMut guards. These guards make borrowed access safe without cloning values, but they lock an entire leaf. Drop them before re-entering the map for a potentially conflicting operation.

use b_link::{BLinkMap, BLinkSet};

let map = BLinkMap::<u64, &str>::new();
assert_eq!(map.insert(7, "seven"), None);
assert_eq!(map.get(&7).map(|entry| *entry), Some("seven"));
assert_eq!(map.remove(&7), Some("seven"));

let set = BLinkSet::<u64>::new();
assert!(set.insert(7));
assert!(set.contains(&7));

Structs§

BLinkMap
A concurrent ordered map backed by a B-link tree.
BLinkSet
A concurrent ordered set backed by BLinkMap.
EntryMut
A write guard for an entry in a BLinkMap.
EntryRef
A read guard for an entry in a BLinkMap.
Iter
An immutable, ascending iterator over a BLinkMap.
KeyRef
A read guard exposing only the key half of one map record.
Keys
An ascending iterator over guarded map keys.
Range
An immutable ascending iterator over a bounded key range.
SetIter
A weakly consistent ascending iterator over a BLinkSet.
SetRange
A weakly consistent ascending iterator over a bounded set range.
SetRef
A read guard for one value stored in a BLinkSet.
ValueRef
A read guard exposing the value and its associated key.
Values
An ascending iterator over guarded map values.

Constants§

DEFAULT_PAGE_CAPACITY
The maximum stable entries/separators per page when BLinkMap is named without an explicit const capacity argument.