Module ic_stable_structures::btreemap
source · Expand description
This module implements a key/value store based on a B-Tree in stable memory.
§V2 layout
---------------------------------------- <- Address 0
Magic "BTR" ↕ 3 bytes
----------------------------------------
Layout version ↕ 1 byte
----------------------------------------
Max key size ↕ 4 bytes Page size ↕ 4 bytes
---------------------------------------- OR ----------------------------------------
Max value size ↕ 4 bytes PAGE_SIZE_VALUE_MARKER ↕ 4 bytes
----------------------------------------
Root node address ↕ 8 bytes
----------------------------------------
Length (number of elements) ↕ 8 bytes
---------------------------------------- <- Address 28 (PACKED_HEADER_SIZE)
Reserved space ↕ 24 bytes
---------------------------------------- <- Address 52 (ALLOCATOR_OFFSET)
Allocator
----------------------------------------
... free memory for nodes
----------------------------------------
§V1 layout
---------------------------------------- <- Address 0
Magic "BTR" ↕ 3 bytes
----------------------------------------
Layout version ↕ 1 byte
----------------------------------------
Max key size ↕ 4 bytes
----------------------------------------
Max value size ↕ 4 bytes
----------------------------------------
Root node address ↕ 8 bytes
----------------------------------------
Length (number of elements) ↕ 8 bytes
---------------------------------------- <- Address 28 (PACKED_HEADER_SIZE)
Reserved space ↕ 24 bytes
---------------------------------------- <- Address 52 (ALLOCATOR_OFFSET)
Allocator
----------------------------------------
... free memory for nodes
----------------------------------------
Structs§
- A “stable” map based on a B-tree.
- An iterator over the entries of a
BTreeMap
.