Skip to main content

read_chunk

Function read_chunk 

Source
pub fn read_chunk(
    path: impl AsRef<Path>,
    position: &Position,
    max_bytes: Option<u64>,
) -> Result<Chunk>
Expand description

read_from, with the offset of each entry and an optional limit.

With max_bytes, a read stops before the entry that would exceed it. The first entry is returned whatever its size, so repeated calls always reach the end of the log.

The limit does not apply to a compressed log, where one call returns everything up to the end. Each call has to decompress the log from the start, so reading it in parts would repeat that for every part.