pub struct ObservationIndex {
pub section_flags: u8,
pub ops: Vec<OpEntry>,
pub selectors: Vec<ObservationSelector>,
pub digests: Vec<ObservationDigest>,
}Expand description
A decoded OBSERVATION_INDEX record.
Field vectors correspond exactly to the sections named by section_flags;
vectors for absent sections are empty.
Fields§
§section_flags: u8Section flags present in the encoded record.
ops: Vec<OpEntry>Per-op entries, present when SECTION_OP_TABLE is set.
selectors: Vec<ObservationSelector>PDF selectors, present when SECTION_PDF_SELECTORS is set.
digests: Vec<ObservationDigest>Output-block digests, present when SECTION_DIGESTS is set.
Implementations§
Source§impl ObservationIndex
impl ObservationIndex
Sourcepub fn encode(&self) -> Result<Vec<u8>>
pub fn encode(&self) -> Result<Vec<u8>>
Encode the payload to canonical bytes.
A section’s flag and its vector must agree: a set flag with an empty vector is encoded as a count of zero (valid), but a clear flag with a non-empty vector is an error rather than a silently dropped section.
Sourcepub fn decode(bytes: &[u8], limits: Limits) -> Result<ObservationIndex>
pub fn decode(bytes: &[u8], limits: Limits) -> Result<ObservationIndex>
Decode and structurally validate a payload.
This checks framing, version, and that every section fits its declared
count. It does not check semantic agreement with a program; call
ObservationIndex::validate with the decoded program for that.
Sourcepub fn validate(
&self,
program: &Program,
object_lens: &[u64],
channel_lens: &[u64],
limits: Limits,
) -> Result<()>
pub fn validate( &self, program: &Program, object_lens: &[u64], channel_lens: &[u64], limits: Limits, ) -> Result<()>
Check the index against the program it claims to describe.
The program (via Program::analyze_ops) is authoritative; the index is
only ever a claim and must agree with it. All arithmetic is checked and
every selector/digest range is bounded by the analyzed total.