Skip to main content

validate_knowledge

Function validate_knowledge 

Source
pub fn validate_knowledge(
    header: &CmfHeader,
    tensors: &[TensorEntry],
    vocab: Option<&[u8]>,
    required_features: u32,
    data_len: Option<u64>,
    raw_trunk_hash: Option<u64>,
    exec: ExecHashes,
) -> Result<(), CmfError>
Expand description

Every knowledge rule (§9.2–§9.5) over a header + directory: the bits ⇔ content in both directions, the genome’s trunk hash, the lineage order, segment bounds, every v2 skill record and the router policy. Called by open() (with the envelope’s bits) and by every writer before a byte is written. Files carrying none of the new bits and no v2 content pass untouched.

raw_trunk_hash: the trunk hash open() computed from the file’s raw header JSON (trunk_hash_json_exec); None = compute it from header (writers, whose header is exactly what they write). exec: the mask / sparse-index sections the file carries (ExecHashes).