Expand description
High-performance, read-optimized key-value maps persisted to massmap files.
The massmap crate provides utilities for building and querying immutable hash
maps that can be memory-mapped or streamed from disk with minimal overhead.
Builders take sorted or unsorted key-value iterators and produce a binary
representation that can be shared between processes, while readers offer
constant-time lookups backed by zero-copy IO traits.
Typical usage involves serializing an iterator with MassMapBuilder and
opening the resulting file with MassMap to perform single or batched
lookups.
use massmap::{MassMap, MassMapBuilder};
let entries = [
("apple".to_string(), 1u32),
("banana".to_string(), 2u32),
];
let file = std::fs::File::create("examples/fruits.massmap")?;
MassMapBuilder::default().build(&file, entries.iter())?;
let file = std::fs::File::open("examples/fruits.massmap")?;
let map = MassMap::<String, u32, _>::load(file)?;
assert_eq!(map.get("banana")?, Some(2));Structs§
- MassMap
- Typed view over a
MassMapInner. - Mass
MapBucket Meta - Metadata describing an individual hash bucket inside a massmap file.
- Mass
MapBuilder - Builder type for emitting massmap files from key-value iterators.
- Mass
MapDefault Hash Loader - Mass
MapHash Config - Configuration for the hash function used in a massmap.
- Mass
MapHeader - Header serialized in raw bytes at the start of the massmap file.
- Mass
MapInfo - Summary returned by
MassMapBuilder::build. - Mass
MapInner - Immutable hash map backed by a serialized massmap file.
- Mass
MapIter - Iterator over all entries in a
MassMap. - Mass
MapMerger - Mass
MapMeta - Metadata serialized at the tail of every massmap file.
Traits§
- Mass
MapHash Loader - Trait for loading a hash function configuration for use in a massmap.
- Mass
MapReader - Trait abstracting read access to massmap files.
- Mass
MapWriter - Trait representing positional writers suitable for massmap serialization.