Expand description
Roaring bitmap types backed by the
Memory
trait.
Application code should construct values with RoaringBitmap::init. This module documents
the stable layout; RoaringBitmap documents runtime behavior and per-method costs.
§V1 layout
---------------------------------------- <- Address 0
Magic `RSB` ↕ 3 bytes
----------------------------------------
Layout version ↕ 1 byte
----------------------------------------
Logical length (`len_bits`) ↕ 8 bytes
----------------------------------------
Journal slot count ↕ 8 bytes
----------------------------------------
Snapshot length ↕ 8 bytes
----------------------------------------
Reserved space ↕ 36 bytes
---------------------------------------- <- Address 64
Mutation record 0 ↕ 5 bytes
----------------------------------------
Mutation record 1 ↕ 5 bytes
----------------------------------------
...
----------------------------------------
Mutation record N - 1 ↕ 5 bytes
---------------------------------------- <- 64 + JOURNAL_CAP_SLOTS * 5
Zero padding ↕ 0..7 bytes
---------------------------------------- <- snapshot_base = align_up(journal end, 8)
Serialized Roaring snapshot ↕ variable lengthThe header is 64 bytes. Journal records are packed into five bytes, and the snapshot begins at
the next eight-byte boundary. The snapshot uses the standard
roaring::RoaringBitmap
serialization format.
§Compatibility and recovery
JOURNAL_CAP_SLOTS is stored in the header. A build with a different capacity has a
different journal and snapshot offset, so it cannot reopen existing memory without an
application-level migration; RoaringBitmap::init returns InitError::InvalidLayout.
Recovery validates the reachable header and snapshot, then replays journal records until the first empty record. It deliberately does not inspect unreachable bytes after that point. The caller must therefore keep the memory region isolated from untrusted writers.
The header version describes this crate’s layout, not the roaring crate version. Compatibility
with the supported Roaring serialization format is covered by a checked-in historical fixture.
Structs§
- Contains
View - Borrowed guard over the heap mirror for batched
Self::containscalls. - Roaring
Bitmap - Stable roaring bitmap with a heap mirror and a durable journal.
Enums§
- Bitmap
Error - Error returned by
RoaringBitmap::newand mutating methods (set,ensure_len, checkpoint I/O, …). - Init
Error - Error returned when
RoaringBitmap::initrejects stable memory contents.