Skip to main content

read_rows

Function read_rows 

Source
pub fn read_rows(
    config_dir: &Path,
    session_id: &str,
    directory: Option<&str>,
    below: Option<&TranscriptAnchor>,
    rows_wanted: usize,
) -> Option<TranscriptSpan>
Expand description

Read the rows of session_id’s transcript that sit strictly before below, newest first, up to rows_wanted of them.

Row-level, on the file’s own coordinates. A page below a window’s floor is a running turn’s older rows, and the conversation’s frame numbering cannot say where they are: a window whose front is a count cut inside a running turn holds frames the CLI streamed and never wrote - thinking-token frames among them - so a numbering that counted those frames cannot be lined up against the file’s rows with arithmetic. A row’s own byte needs no numbering, so the read works in bytes from an anchor: the row the page above handed back as its cursor, or the file’s own end when the walk’s first ask names none.

Bounded by construction. The read takes a window of the file, grows it only while the rows it needs are not inside the window it took, and never reads past SPAN_CAP_BYTES. None when the transcript cannot answer for this session: no file, an anchor the file does not carry, an anchor further from the file’s end than the cap reaches, or a window that could not be read. The caller answers all of them as the end of the history, which is what a page this read cannot vouch for deserves.