Skip to main content

structural_corruption_reason

Function structural_corruption_reason 

Source
pub fn structural_corruption_reason(doc: &str) -> Option<String>
Expand description

Detect structural corruption that must never be adopted as a snapshot base (#dupcontent). Returns Some(reason) when the document is corrupt:

  • a parse failure (mismatched / unclosed markers),
  • more than one opening marker for a singleton component (duplicate block),
  • an unterminated double-quoted attribute on a component opening marker.

Returns None when the document is structurally sound. Used to fail closed before adopting a content_ours / visible-write IPC buffer whose prior CRDT merge produced duplicate singleton blocks or a split attribute, so the corrupt buffer never reaches disk.