spam-db
Rust library for reading spam databases.
SPAM indexes Nix package closures and nixosOptionsDoc output into compressed,
bucket-indexed databases. This crate lets you open those databases and run
substring queries against them.
Usage
[]
= "0.2"
Query an options database
use OptionsDb;
let db = open?;
for rec in db.query?
Query a packages database
use PackagesDb;
let db = open?;
for rec in db.query?
Auto-detect database kind
use SpamDb;
match open?
Database format
A spam database is a binary file with three sections:
# spam-db-v2\t{options|packages}\n
[256 x 16-byte index entries: (offset: u64le, length: u64le)]
[concatenated zstd-compressed bucket blobs]
Each line in the database is placed in every bucket corresponding to a unique
byte in its search key. Queries decompress only the bucket for query[0],
keeping lookup sublinear in the total database size.
Building spam databases
Use the spam CLI: