Skip to main content

read_session_lite

Function read_session_lite 

Source
fn read_session_lite(
    path: &Path,
    cache: Option<&SessionTagCache>,
    scan_tag: bool,
) -> Option<LiteSessionFile>
Expand description

Open a session file, stat it, read at most LITE_READ_BUF_SIZE bytes from the head and the same from the tail. For files smaller than the buffer, tail == head (single read). Returns None on any I/O error or for empty files.

The tag scan that follows is NOT bounded by that buffer - it reads the file end to end, so this is a lite read of the metadata and a full read of the bytes. See scan_tag_from.

Each .ok()? early return logs at debug level naming the step that failed - without these, the session picker silently drops sessions whose files have permission errors / are mid-truncation / have a bad fd, which presents to the user as missing sessions with no triage signal.