Skip to main content

read_journal_counts

Function read_journal_counts 

Source
pub(super) fn read_journal_counts(
    path: &Path,
    offset: u64,
) -> Result<(usize, usize, u64), String>
Expand description

Count new started / result records in a workflow journal from offset. Returns (started, results, new_offset).

Reads line-by-line via read_until(b'\n', ..) rather than BufRead::lines() so a trailing line with no \n yet (the writer racing a partial append) is never counted or consumed: new_offset only ever advances past complete, newline-terminated lines, so the next call re-reads that partial line whole once the rest of it lands, instead of seeking mid-line and silently losing the record’s leading bytes (and the record itself, since the resulting truncated JSON fails to parse).