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§
- Blob
Asset Def - One component record in the blob’s def stream.
- Blob
Data - Holds the raw payload sections of each blob file.
- Blob
Meta - 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_lenmeasures. Folding everything into one block keeps the 16-byte header and every payload-offset computation (payload_section_start, the lock’spayload_bytes) unchanged; only the block’s contents grew. Blob 0 carries the full metadata; overflow blobs carry an emptyBlobMeta(whose default manifest is consistent with its empty streams). - Resource
Record - One entry in the blob’s resource stream: a compiled resource addressed by its
dense per-kind handle, carried alongside the component stream.
resource_kindselects the per-kind table (ResourceKind as u8);handleis the dense index within that kind (== the record’s position within its kind). A payload resource (mesh, texture, audio clip) carries aPayloadLocatorinto the blob payload section; a data resource (a baked Material) carries its runtime bytes indata_bytes. Both fields are present so either shape round-trips; a given kind uses one branch (AudioClip usespayload). - World
Manifest - 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_indexnames 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
.cnbblob starts with, theBlobKindmagic ofBlobMeta. A cache segment carriesCACHE_MAGICinstead. - 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_atopened (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
primaryand the payload store around it, anchoring the process’s blob layout on it, so a world written todata/0readsdata/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
PayloadLocatoroffset 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’sdata/, 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.