grafos_collections/
lib.rs

1//! Distributed data structures backed by leased fabric memory.
2//!
3//! This crate provides collection types that store their data in remote
4//! memory regions obtained through [`grafos_std::mem::MemLease`] or block
5//! storage via [`grafos_std::block::BlockLease`]. Each collection owns its
6//! lease and releases it automatically on drop.
7//!
8//! # Collections
9//!
10//! | Type | Backing | Description |
11//! |------|---------|-------------|
12//! | [`FabricVec<T>`](vec::FabricVec) | Memory | Growable array with fixed-stride slots |
13//! | [`FabricHashMap<K,V>`](map::FabricHashMap) | Memory | Hash map with open addressing and linear probing |
14//! | [`FabricQueue<T>`](queue::FabricQueue) | Memory | Bounded SPSC ring buffer |
15//! | [`Durable<T>`](durable::Durable) | Block | Checkpoint/restore wrapper |
16//!
17//! # Quick start
18//!
19//! ```rust
20//! use grafos_collections::vec::FabricVec;
21//! use grafos_std::mem::MemBuilder;
22//!
23//! # grafos_std::host::reset_mock();
24//! # grafos_std::host::mock_set_fbmu_arena_size(65536);
25//! let lease = MemBuilder::new().min_bytes(4096).acquire()?;
26//! let mut v: FabricVec<u32> = FabricVec::new(lease, 16)?;
27//! v.push(&42)?;
28//! assert_eq!(v.get(0)?, 42);
29//! # Ok::<(), grafos_std::FabricError>(())
30//! ```
31//!
32//! # Feature flags
33//!
34//! | Feature | Default | Effect |
35//! |---------|---------|--------|
36//! | `std` | Yes | Enables `std` in grafos-std (thread-local mock state) |
37
38#![cfg_attr(not(feature = "std"), no_std)]
39
40extern crate alloc;
41
42pub mod durable;
43pub mod map;
44pub mod queue;
45pub mod vec;