Skip to main content

Module blob

Module blob 

Source
Expand description

Blob file reading and lazy payload residency live in concinnity_host::store; re-export them under the historical crate::blob::* paths. pub so the editor crate’s in-memory build path can construct BlobData.

Structs§

BlobAssetDef
One component record in the blob’s def stream.
BlobData
Holds the raw payload sections of each blob file.
BlobMeta
The blob’s metadata section: the component stream, the resource stream, and the manifest summarizing them, postcard-serialized together as the block the header’s meta_len measures. Folding everything into one block keeps the 16-byte header and every payload-offset computation (payload_section_start, the lock’s payload_bytes) unchanged; only the block’s contents grew. Blob 0 carries the full metadata; overflow blobs carry an empty BlobMeta (whose default manifest is consistent with its empty streams).
ResourceRecord
One entry in the blob’s resource stream: a compiled resource addressed by its dense per-kind handle, carried alongside the component stream. resource_kind selects the per-kind table (ResourceKind as u8); handle is the dense index within that kind (== the record’s position within its kind). A payload resource (mesh, texture, audio clip) carries a PayloadLocator into the blob payload section; a data resource (a baked Material) carries its runtime bytes in data_bytes. Both fields are present so either shape round-trips; a given kind uses one branch (AudioClip uses payload).
WorldManifest
A verified summary of the blob’s shape, produced by cook from the final record streams and carried alongside them in the metadata block. The runtime trusts it (debug builds re-derive and assert it matches): the per-type counts pre-size the ECS columns before the bulk component load, and max_blob_index names the overflow files without scanning either stream. Anything further (type presence, feature flags) is deliberately not duplicated here: it is a counts lookup away.

Constants§

BLOB_MAGIC
The four magic bytes a cooked-world .cnb blob starts with, the BlobKind magic of BlobMeta. A cache segment carries CACHE_MAGIC instead.
HEADER_SIZE
Fixed blob header size, the same for every kind: magic (4) + validity token (4) + meta_len (8).
SCHEMA_VERSION
The version of everything a cooked blob’s bytes depend on: the postcard-visible component schema, the blob container’s record shapes, and the payload formats in bake. Stamped into every blob header and folded into the cook’s payload cache key.

Functions§

blob_path
Format a blob file path for a given index. Blob 0 is the primary blob load_raw_at opened (the metadata block plus the first payload section); higher indices are overflow payload blobs, which are always its siblings. The format crate is path-agnostic; this layout knowledge stays here.
load_raw_at
Load the blob file at primary and the payload store around it, anchoring the process’s blob layout on it, so a world written to data/0 reads data/1, data/2, … beside it. The anchor outlives the call because payloads stream off disk long after startup: a locator resolved mid-frame has no caller to carry the layout down from.
payload_section_start
Byte offset within a blob file at which its payload section begins. Reads only the header; the disk-backed streaming source uses it to turn a PayloadLocator offset into an absolute file offset. Used only by the Metal-driven disk-backed streaming source for now (Vulkan/DirectX streaming catch-up is a follow-up).
primary_in
The primary blob inside data_dir: blob 0, holding the metadata block plus the first payload section. What a host opens when it reads a state tree’s data/, and what a build writes there.
read_cnb
Read and deserialize a blob’s metadata section (component defs + resource records). Returns (meta, payload_start_offset).
world_from
A world that reads its compiled payloads from blob. The world names the payload store only through its access seam, so this is where the blob file format meets it.