[stream] read the compatibility archive after history
30 unmodified lines3132333435363738394041424344454647353637381 unmodified line404142435744454647484950515253545556575859606162631368 unmodified linesExpand all30 unmodified lines { return Ok(Some(body)); }
let archive_key = keys::event_body_key(record_key, cid); if let Some(body) = self .stream .event_bodies .get(archive_key) .into_diagnostic()? { if !matches(&body) { miette::bail!("compatibility event body at {cid} is corrupt"); } return Ok(Some(body)); }
for guard in self .indexer .history_range(keys::history_range_after(record_key, event_rev)) {1 unmodified line if keys::history_hit_for(record_key, &key) && !body.is_empty() && matches(&body) { return Ok(Some(body)); } } Ok(None)
// last, because only events from before v10 keep a body here. a database started at v10 or // later has none let archive_key = keys::event_body_key(record_key, cid); let Some(body) = self .stream .event_bodies .get(archive_key) .into_diagnostic()? else { return Ok(None); }; if !matches(&body) { miette::bail!("compatibility event body at {cid} is corrupt"); } Ok(Some(body)) }}
/// [`ipld_cid_from_record_value`] as a string1368 unmodified linesExpand all399 unmodified linesExpand all400401402403404405406407408409404405406407408409556 unmodified linesExpand all399 unmodified linesExpand all } }}
/// resolve the body an event's record pointer refers to.////// current heads and the exact pre-v10 compatibility archive are point-read/// first; ordinary deaths after this event's rev are then scanned for the body/// whose cid the event claims. every candidate is content-verified by the db/// resolver before it can be returned./// tries the current head, then the history after this event's rev, then the pre-v10 archive./// a body only counts if it matches the event's cidpub(crate) fn resolve_event_body( state: &AppState, id: u64, did: &TrimmedDid,556 unmodified linesExpand all