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 every
.cnbblob starts with. - HEADER_
SIZE - Fixed blob header size: magic (4) + schema version (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
build. 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 (the metadata block plus the first payload section); higher indices are overflow payload blobs, which are always siblings of blob 0. The format crate is path-agnostic; this layout knowledge stays here.
- load_
defs - Load defs without resolving (for callers that apply overlays first)
- load_
raw - Load the primary blob’s metadata and the
BlobDatapayload store from the state root’sdata/layout, without resolving defs into runtimeAssets (that resolution depends on the client runtime registry, so it lives in the clientblob::loadshim). - load_
raw_ at - Load the blob file at
primaryand the payload store around it, anchoring the process’s blob layout on it: that file is blob 0 and its siblings named by index are the overflow payload blobs, so a world written todata/0readsdata/1,data/2, … beside it. The anchor outlives the call because payloads stream off disk long after startup. - 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). - read_
cnb - Read and deserialize a blob’s metadata section (component defs + resource records). Returns (meta, payload_start_offset).
- texture_
resource_ count - Number of Texture resource records in the primary blob’s metadata, read
without loading any payload. This is the compiled world’s texture-table
length;
cn exportuses it to precompile the built-in shaders whose bindless texture pool is sized per world. - 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.