Expand description
A hash map stored in leased fabric memory with open addressing.
FabricHashMap<K,V> stores key-value pairs in a remote memory region
obtained via MemLease. Collision resolution uses linear probing.
Keys are hashed with FNV-1a after postcard serialization.
§Memory layout
Offset 0: [header] count: u64 (8) | bucket_count: u64 (8) | key_stride: u64 (8) | val_stride: u64 (8)
Offset 32: [buckets] bucket 0 | bucket 1 | ...
Each bucket (1 + 8 + 4 + key_stride + 4 + val_stride bytes):
occupied: u8 (1) | hash: u64 (8) | key_len: u32 (4) | key_data: key_stride bytes | val_len: u32 (4) | val_data: val_stride bytesThe occupied byte is 0 for empty, 1 for occupied, 2 for
tombstoned (deleted but still part of the probe chain).
§Example
use grafos_collections::map::FabricHashMap;
use grafos_std::mem::MemBuilder;
let lease = MemBuilder::new().min_bytes(65536).acquire()?;
let mut map: FabricHashMap<String, u64> = FabricHashMap::new(lease, 32, 16)?;
map.insert(&"key".into(), &42)?;
assert_eq!(map.get(&"key".into())?, Some(42));Structs§
- Fabric
Hash Map - A hash map stored in leased fabric memory with open addressing.
- Fabric
Hash MapIter - Iterator over key-value pairs in a
FabricHashMap.