massmap
Static hash table that scales via disk-backed expansion to trim memory usage while ensuring each lookup needs exactly one I/O.
Installation
Add massmap to your Cargo.toml:
or manually:
[]
= "0.1"
Quick Start
use ;
CLI tool
A command-line utility massmap is provided for inspecting and querying massmap files.
# 1. install the CLI tool
# 2. convert a JSON file to massmap format
#> {
#> "file_length": 656,
#> "entry_count": 47,
#> "bucket_count": 32,
#> "empty_buckets": 5,
#> "meta_offset": 486,
#> "meta_length": 170,
#> "hash_seed": 0
#> }
# 3. query a key from the massmap file
#> {
#> "file_length": 656,
#> "entry_count": 47,
#> "bucket_count": 32,
#> "empty_buckets": 5,
#> "meta_offset": 486,
#> "meta_length": 170,
#> "hash_seed": 0
#> }
#> 1999: Some(Number(7229))
Readers and Writers
MassMapReader and MassMapWriter abstract over positional IO. The traits are implemented for std::fs::File out of the box, but they can also wrap network storage, memory-mapped regions, or custom paged backends. Override MassMapReader::batch_read_at to dispatch vectored reads when available.
Format Layout
Every massmap file begins with a 24-byte header containing a magic number, metadata offset, and metadata length. Key/value buckets are stored contiguously after the header in MessagePack format, followed by a serialized MassMapMeta structure that records bucket locations and hashing parameters.
Documentation
Comprehensive API documentation is available on docs.rs.
License
This project is dual-licensed under the MIT License and Apache License 2.0.