Expand description
.urna binary file layout (v1)
File structure:
[0 .. 128) UrnaHeader (128 bytes)
[128 .. 128+count*32) SectionTable (32 bytes per entry)
[manifest_offset .. ...) Manifest JSON (JCS canonical)
[sections ...] Required sections, each starting at a
64-byte aligned offset; padding before
each section is zero and is NOT part of
the section's checksum
[file_size-40 .. file_size) Footer (40 bytes)All multi-byte integers are little-endian, unsigned unless noted.
Structs§
Constants§
- CANONICAL_
SECTIONS - Canonical order for content_hash. Sorted alphabetically by name; this order is fixed by spec so adding new section IDs cannot reshuffle the hash. Keep this list and section IDs in sync.
- LEGACY_
MAGIC - magic written by releases up to 0.4.0, before the project was renamed. the reader accepts it (same layout, same hashes); the writer never emits it.
- OPTIONAL_
SECTIONS - Optional sections - present when their corresponding capability is advertised in the manifest. They do NOT participate in content_hash (which is over the canonical six only) so adding an optional section to a corpus does not invalidate citations.
- REQUIRED_
SECTIONS - Required sections for a v1 .urna file. A reader rejects any file
missing one of these with
MissingRequiredSection. - SECTION_
ALIGNMENT - Every section’s
offsetis aligned to this many bytes. Padding before each section is zero and is NOT covered by the section’s checksum. Chosen to match common SIMD widths so embeddings can be loaded directly from mmap. - SECTION_
BLOB_ DATA - SECTION_
BLOB_ REFS - SECTION_
BLOB_ SPAN_ OVERLAY - SECTION_
BM25_ INDEX - SECTION_
CHUNKS_ CANONICAL - SECTION_
CHUNKS_ ORIGINAL_ SPANS - SECTION_
CHUNK_ IDS - SECTION_
CHUNK_ SCALARS - SECTION_
DEDUP_ MAP - SECTION_
DICTIONARY - SECTION_
EDIT_ JOURNAL - SECTION_
EMBEDDINGS - SECTION_
EMBEDDINGS_ FP - SECTION_
ENCODING_ FLOA T16 - SECTION_
ENCODING_ FRONTCODE - SECTION_
ENCODING_ FSST - SECTION_
ENCODING_ INT4 - SECTION_
ENCODING_ INT8 - SECTION_
ENCODING_ INTPACK - SECTION_
ENCODING_ RABITQ - SECTION_
ENCODING_ RAW - Section payload encoding.
- SECTION_
ENCODING_ TXT_ STREAMS 10 = txt_streams: the chunks_canonical (0x02) section’s COMPRESSED form re-laid-out from one concatenated zstd-19 blob into N independently zstd-encoded streams (one per canonical string) behind an intpack offset table (O(1) single-chunk seek/reopen). decodes BYTE-IDENTICALLY to the raw chunks_canonical payload, so content_hash and urna:// citations are unchanged. only valid for non-embedding sections. this is the named prerequisite layout for the dict(5)/fsst(9) text levers; a per-chunk frame loses cross-chunk LZ context (small ratio cost today) but is where a trained dict/fsst can beat one big zstd-19 blob.- SECTION_
ENCODING_ ZSTD - SECTION_
ENCODING_ ZSTD_ DICT - SECTION_
GRAPH_ ADJACENCY - SECTION_
GRAPH_ EDGE_ PROPS - SECTION_
GRAPH_ ENTITY_ MAP - SECTION_
GRAPH_ NODES - SECTION_
HNSW_ INDEX - SECTION_
PAYLOAD_ PREFIX_ SIZE - Common prefix for all internal section payloads (12 bytes): u32 version (LE) u64 entry_count (LE)
- SECTION_
PAYLOAD_ VERSION - SECTION_
PROVENANCE - SECTION_
REPRO_ MANIFEST - SECTION_
SEARCH_ CONTRACT - SECTION_
SPACE_ EMBEDDINGS_ BASE - SECTION_
SPACE_ EMBEDDINGS_ FP_ BASE - SECTION_
SPACE_ TABLE - SECTION_
TOKENIZER_ MODEL - SPACE_
BAND_ LEN - URNA_
FOOTER_ SIZE - URNA_
FORMAT_ VERSION - Format version of the binary layout. Bumped when the on-disk container changes (header/footer/section table layout).
- URNA_
HEADER_ SIZE - URNA_
MAGIC - URNA_
SCHEMA_ VERSION - Schema version of the manifest/contract. Bumped when manifest fields or required section semantics change.
- URNA_
SECTION_ ENTRY_ SIZE - URNA_
VERSION_ MAJOR - URNA_
VERSION_ MINOR
Functions§
- align_
up - Round
nup to the next multiple ofa.amust be a power of two. - section_
name