Crate concurrent_map

source ·
Expand description

A lock-free B+ tree based on sled’s internal index structure, but supporting richer Rust types as keys and values than raw bytes.

This structure supports atomic compare and swap operations with the ConcurrentMap::cas method.

The ConcurrentMap allows users to tune the tree fan-out (FANOUT) and the underlying memory reclamation granularity (LOCAL_GC_BUFFER_SIZE) for achieving desired performance properties. The defaults are pretty good for most use cases but if you want to squeeze every bit of performance out for your particular workload, tweaking them based on realistic measurements may be beneficial. See the ConcurrentMap docs for more details.

If you want to use a custom key type, you must implement the Minimum trait, allowing the left-most side of the tree to be created before inserting any data. If you wish to perform scans in reverse lexicographical order, you may instead implement Maximum for your key type and use std::cmp::Reverse.

This is an ordered data structure, and supports very high throughput iteration over lexicographically sorted ranges of values. If you are looking for simple point operation performance, you may find a better option among one of the many concurrent hashmap implementations that are floating around.

Structs

Traits

  • Trait for types for which a maximum possible value exists.
  • Trait for types for which a minimum possible value exists.