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 every .cnb blob 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 BlobData payload store from the state root’s data/ layout, without resolving defs into runtime Assets (that resolution depends on the client runtime registry, so it lives in the client blob::load shim).
load_raw_at
Load the blob file at primary and 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 to data/0 reads data/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 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).
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 export uses 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.