Skip to main content

compare_complete_prefix

Function compare_complete_prefix 

Source
pub fn compare_complete_prefix(
    contents_a: &str,
    contents_b: &str,
    opts: &LogDiffOpts,
    w: &mut impl Write,
) -> Result<PrefixComparison>
Expand description

Compare only the records both logs have finished writing.

The tail of a log being written may be half-flushed, and a half-flushed record is not a difference – it is an absence. Truncating both inputs to their common complete prefix is what makes this safe to run against a live run: bytes that have not been written yet can never be mistaken for bytes that disagree.