Skip to main content

Module v06

Module v06 

Source
Expand description

Format generation 0x06 (SPEC.md §4): everything a reader needs to plan a query sits at the front of the file — a 128-byte header, the root block, the Dataset Card, the planner statistics and every leaf directory — and the payload follows, clustered by section.

0          header (128 B)
128        root block: section table + directory roots
           card region: card | build record | slack
           front sections: stats+schema, then the leaf directories
data_off   data sections: dictionary chunks, index tiles, quad tiles,
           label blocks, text postings, pyramid
file_len-8 footer "RETE" 06 00 00 00

Payload blocks (dictionary chunks, index tiles, quad tiles, label blocks, postings) are byte-identical to 0x05; only their framing and their directories move. parts lifts a 0x05 file into parts::Parts, write assembles a 0x06 file from them, open reads one.

Modules§

kind
Section kinds of the root’s section table.
open
Reading a 0x06 file: the header and the root come with the first read; everything else is built lazily from them — the dictionary and the index as two-level directories whose leaves fault on demand and stay for the session, the text index likewise, the label index and the quad index through their own lazy machinery.
parts
The logical parts of a file, independent of its generation: what the 0x06 assembler (super::write) lays out. from_v05 lifts them from a 0x05 file by reading its framing and directories; payload blocks are referenced by their byte range in the input and copied verbatim.
tag
Unit-root tags inside the root block.
write
The 0x06 assembler: super::parts::Parts in, a 0x06 file out. Every writer goes through here — the in-RAM build (via 0x05 section images), rete convert, and the memory-bounded build and merge (which hand it their spill as an address space, see extbuild_v06). recard only re-lays the front.

Structs§

ChunkEnt
One dictionary chunk as a leaf lists it.
Cur
A bounds-checked cursor over untrusted bytes.
DictSecRoot
The root of one dictionary section.
Header06
The parsed 128-byte header.
LabelRoot
The root of the label index: the 0x05 preamble and root node, and where the data blocks end in the 0x05 body coordinates (SPEC.md §6.4).
LeafRef
One leaf of a two-level directory, as the root describes it.
PermRoot
The root of one permutation’s tile directory.
QTileEnt
One quad tile as a leaf lists it.
QuadOrderRoot
One order of the quad index.
QuadRoot
The root of the quad index.
Root06
The decoded root block.
Sec06
One entry of the root’s section table.
TextRoot
The root of the text index.
TileEnt
One index tile as a leaf lists it.
TokenEnt
One text token as a leaf lists it.

Constants§

BLOCK_CEILING
The decompression bound of a section whose largest block is not recorded (label blocks and nodes; the writer cuts them at 16 KiB).
CARD_MAX
The bound on the Dataset Card, decompressed.
CARD_SLACK_MIN
Slack added to the card region beyond twice the card + record.
FIRST_READ
What a reader fetches first: header, root, card, statistics and, on a small file, every leaf directory (SPEC.md §9).
FOOTER
The 8-byte footer: the generation, then RETE — so every reader that confirms a length by the file’s last four bytes finds the magic there.
F_NAMED
Header flag: the file has named graphs (in the quad index).
F_QUAD_GRAPH_MAJOR
Header flag: quad tiles are clustered graph-major (all orders of a block of graphs adjacent) rather than order-major.
F_QUOTED
Header flag: some terms are RDF-star quoted triples.
F_TEXT_NAMED
Header flag: the text index also covers the named graphs’ literals.
HEADER_LEN
Fixed header length.
LEAF_START
Starting (uncompressed) size of a leaf block.
P_LABELS
Presence bit: a label index.
P_PYRAMID
Presence bit: the community pyramid.
P_QUAD
Presence bit: the quad index.
P_SCHEMA
Presence bit: a stats + schema section.
P_TEXT
Presence bit: a text index.
P_TEXT_PARTIAL
Presence bit: the text index leaves some predicates out (kind 11 in 0x05).
ROOT_BUDGET
The writer’s root budget: leaves grow until the stored root fits.
SEC_ENTRY_LEN
Size of one section-table entry.
UNIT_MAX
The bound on the root’s unit roots, decompressed (Meta’s are ~100 KiB).
VERSION
The format byte of this generation.

Functions§

content_hash
The content hash of a header whose card and root digests are set (SPEC.md §5): the logical header fields, the card and the root, never an offset and never the build record.
cut
Cut sizes (each entry’s encoded size) into leaves of about target bytes: (start, end) index ranges, never empty, covering everything.
decode_chunk_leaf
Decode n chunk entries.
decode_dict_root
Decode the dictionary unit root.
decode_index_root
Decode the index unit root.
decode_label_root
Decode the label unit root.
decode_qtile_leaf
Decode n quad tile entries of a leaf whose first tile sits at leaf_off.
decode_quad_root
Decode the quad unit root.
decode_text_root
Decode the text unit root.
decode_tile_leaf
Decode n tile entries.
decode_token_leaf
Decode n token entries.
digest16
The first 16 bytes of a BLAKE3 digest.
encode_chunk_leaf
Encode chunk entries (the first first_run absolute, then deltas).
encode_dict_root
Encode the dictionary unit root.
encode_index_root
Encode the index unit root (permutations in section-index order).
encode_label_root
Encode the label unit root.
encode_qtile_leaf
Encode quad tile entries. A tile’s offset is written as 0 when it follows the previous tile of the leaf (or, for the first, sits at the leaf’s root offset), else as offset + 1 (PMTiles’ clustered encoding).
encode_quad_root
Encode the quad unit root.
encode_text_root
Encode the text unit root.
encode_tile_leaf
Encode tile entries: the 0x05 directory rows, then the synopsis rows.
encode_token_leaf
Encode token entries, front-coded within the leaf.
id_position_names
Names of the four id positions, in field order, for display.
id_widths_for
The width byte a writer stamps: every position u32 (0), after checking that the largest id of each position ([subjects, objects, predicates, graphs], SPEC §4.1) fits. It never truncates: an id that does not fit is an error.
logical_header
A logical, 0x05-shaped crate::header::Header for a 0x06 file, so code that asks presence questions (text_index_len > 0, label_index_section()) answers them the same for both formats. Its offsets all point at the end of the file, so a physical read that was not ported to 0x06 fails loudly instead of reading the wrong bytes.
put_lp
Append a length-prefixed byte string.

Type Aliases§

QuadLeafRoot
A quad order’s leaf in the root: the leaf, the first tile’s first (g, a), the last tile’s last (g, a), and the first tile’s offset in quad.