Skip to main content

Module bundle

Module bundle 

Source
Expand description

.hmc — a transparent container-of-files bundle for shipping a set of sealed assets (.10d / .q42 / .p64) as one attestable unit. Available to both native and WASM builds (native adds the zero-copy BundleMmap). .hmc — the hyper-media-container: a transparent container-of-files bundle for shipping a set of sealed Qualia assets (.emf spectral media, .10d meshes, .q42 graph volumes, .p64 weights, …) as one attestable unit (a release artefact, a downloadable pack, a signed asset set).

§Why a bundle, and why transparent

The Qualia container family (.10d / .q42 / .p64) are all internally navigable — you can pull a segment (a mesh section, a subgraph, a weight shard) without reading the whole file, ideally mmap zero-copy. A bundle must not destroy that. So a .hmc bundle only concatenates intact files, page-aligned, with an index of absolute offsets — it never compresses, re-chunks, or reframes an entry. Consequences:

  • reader.get(key) returns a zero-copy slice that is a byte-identical standalone file — feed it straight to the existing .q42/.10d/.p64 reader; its interior offsets resolve unchanged.
  • reader.segment(key, off, len) reaches an interior segment of an entry directly — the bundle does not interfere with segment-level access.
  • HTTP range-fetching one interior segment works: entry.offset + seg.off.

It lives in qualia-core-db so it is one reader for both channels — native (BundleMmap, zero-copy) and WASM (parse fetched/ranged bytes).

See format for the on-disk layout.

Structs§

BundleEntry
One row of the bundle index (the CBOR footer). Describes one intact embedded file: its logical key, its format kind, where it lives (absolute, aligned), its length, a SHA-256 of the exact bytes, and opaque per-entry meta (a nested CBOR blob whose schema is agreed by the producer/consumer of a given bundle kind — e.g. an anatomy pack stores each organ’s body-system, position and default colour there). The bundle format itself stays domain- agnostic: it moves intact files; meta carries any domain semantics.
BundleMmap
Open a .hmc bundle from disk via mmap for zero-copy access (native).
BundleReader
A parsed, integrity-checked view over a .hmc bundle’s bytes. Borrows the input; get/segment return slices into it (zero copy).
BundleWriter
Accumulates intact files and serialises them into a .hmc bundle.

Enums§

BundleError
An error building or reading a .hmc bundle.

Constants§

BUNDLE_ENTRY_ALIGN
Alignment (bytes) applied to every entry payload and the index footer. Page alignment (64) preserves the interior page-alignment of embedded .q42 / .p64 / .10d files, so their own segment offsets stay aligned and mmap / zero-copy segment access into an entry is unaffected. This matches the Page alignment tier of the container_10d writer and p64_weight.
BUNDLE_HEADER_SIZE
Fixed header size in bytes. Payloads begin at (or after) this offset.
BUNDLE_MAGIC
Magic bytes at the start of every .hmc (hyper-media-container) bundle: QBDL. The 4-byte on-disk format tag is retained across the .qualia.hmc rename (extension ≠ magic, as with most formats), so bundles already built keep parsing; only the file extension and human-facing name changed.
BUNDLE_VERSION
Current bundle format version.
SHA256_LEN
Length of a SHA-256 digest in bytes.