Expand description
Paginated stream reader for the JSONL log file.
RAM contract: at any moment, in-memory state is bounded by limit
(the number of events the caller asked for) plus a single-line read
buffer. We do NOT slurp the whole file into a String.
The pagination model is cursor-by-timestamp + cursor-by-id. Callers
pass until_ts to ask for “events strictly older than this timestamp
(or older with the same timestamp by id ordering)”. Returning page
includes next_cursor which is the oldest event’s (timestamp, id)
pair — callers use that to ask for the next page.
Filters apply lazily: the reader scans backwards from EOF, decoding
each line, applying the filter predicate, and stopping when it has
collected limit matches or exhausted the file. Worst case for tight
filters: the whole file is scanned. Best case (no filter): only
limit lines decoded.
Structs§
- LogFilter
- Filter parameters for
load_page. Each field is independent; an event must match ALL provided constraints to be included. - LogPage
- One page returned by
load_page.
Functions§
- current_
log_ path - Helper for the gateway: the path the writer is configured to use.
- find_
event_ by_ id - Find a single event by id. Scans the file backwards from the end.
- load_
page - Load one page of events. Newest first.