grafos_collections/
lib.rs

1//! Lease-local data structures backed by fabric memory and block resources.
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//! These collections are building blocks, not cross-failure-domain resources
9//! by themselves. They do not carry placement policy, quorum, replica
10//! membership, or provider-failure promises. Use `grafos_replicated` when a
11//! program needs a logical map, queue, object store, or checkpoint that
12//! remains available across failure domains.
13//!
14//! # Collections
15//!
16//! | Type | Backing | Description |
17//! |------|---------|-------------|
18//! | [`FabricVec<T>`](vec::FabricVec) | Memory | Growable array with fixed-stride slots |
19//! | [`FabricHashMap<K,V>`](map::FabricHashMap) | Memory | Hash map with open addressing and linear probing |
20//! | [`FabricQueue<T>`](queue::FabricQueue) | Memory | Bounded SPSC ring buffer |
21//! | [`Durable<T>`](durable::Durable) | Block | Checkpoint/restore wrapper |
22//!
23//! # Quick start
24//!
25//! ```rust
26//! use grafos_collections::vec::FabricVec;
27//! use grafos_std::mem::MemBuilder;
28//!
29//! # grafos_std::host::reset_mock();
30//! # grafos_std::host::mock_set_fbmu_arena_size(65536);
31//! let lease = MemBuilder::new().min_bytes(4096).acquire()?;
32//! let mut v: FabricVec<u32> = FabricVec::new(lease, 16)?;
33//! v.push(&42)?;
34//! assert_eq!(v.get(0)?, 42);
35//! # Ok::<(), grafos_std::FabricError>(())
36//! ```
37//!
38//! # Feature flags
39//!
40//! | Feature | Default | Effect |
41//! |---------|---------|--------|
42//! | `std` | Yes | Enables `std` in grafos-std (thread-local mock state) |
43
44#![cfg_attr(not(feature = "std"), no_std)]
45
46extern crate alloc;
47
48pub mod durable;
49pub mod map;
50pub mod queue;
51pub mod vec;