1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! The .cnb blob container format.
//!
//! Layout of a blob binary:
//!
//! `[ 4 bytes magic ][ 4 bytes schema version ][ 8 bytes meta_len ][ meta_bytes ][ payload_bytes ... ]`
//!
//! The header is fixed at 16 bytes. `meta_len` is the byte length of the
//! postcard-serialized `BlobMeta` that follows: the component defs stream and
//! the resource records stream. Everything after meta_len + meta_bytes is the
//! raw payload section, addressed by the (blob_index, offset, length) fields
//! inside each BlobAssetDef / ResourceRecord.
//!
//! Blob 0 is the primary blob. It always holds the full metadata and may also
//! hold payload bytes for assets packed before the size ceiling. Overflow
//! payloads spill into blobs 1, 2, ... as needed. All blobs share the same
//! header format; only blob 0 carries non-empty metadata.
//!
//! This module owns the format contract and nothing else: the record schema,
//! the header consts, the version, and the pure bytes <-> metadata transforms.
//! It performs no I/O and holds no residency policy, so it never learns where
//! blob files live or which of them are resident. Callers own both:
//! `concinnity_host::store` reads the state root's `data/` layout into `BlobData`,
//! concinnity-cook writes what `encode_cnb` returns. Being I/O-free is what
//! lets a no_std client runtime decode blobs with its own byte source.
//!
//! Nothing here needs to change when a new asset type is added.
pub use encode_cnb;
pub use BlobError;
pub use ;
pub use ;
pub use ;
// The identity and payload-address types the records carry, owned by the
// schema crate.
pub use ;
/// The four magic bytes every `.cnb` blob starts with.
pub const BLOB_MAGIC: = *b"CNB\0";
/// Fixed blob header size: magic (4) + schema version (4) + `meta_len` (8).
pub const HEADER_SIZE: usize = 16; // magic(4) + schema version(4) + meta_len(8)