Skip to main content

since_slice

Function since_slice 

Source
fn since_slice(
    bytes: &[u8],
    start_idx: u64,
    since: Option<u64>,
) -> (Range<usize>, u64)
Expand description

Where to start reading len bytes that begin at start_idx in the whole log, for a reader that has seen everything before since; and the log’s absolute end, the next since. Offsets are absolute, so they keep growing even when a circular file drops its oldest bytes. A since before what is still held reads all of it; one past the end (a cleared log) reads it all again. The range holds whole characters only: it starts past any continuation bytes (a wrapped log can begin mid-character) and stops before a character still being written, which the next read returns.