Skip to main content

load_page

Function load_page 

Source
pub fn load_page(
    path: &Path,
    filter: &LogFilter,
    limit: usize,
) -> Result<LogPage>
Expand description

Load one page of events. Newest first.

Implementation: we open the file, read it line by line into a fixed in-memory buffer (capped at limit matched events). To preserve the “newest first” order without reading from the tail, we accumulate matched events into a VecDeque, keeping the cap = limit, popping the front when overflowed. Final result is reversed in place. That gives us a one-pass, single-allocation-bounded reader without needing mmap or reverse-byte-stream gymnastics.