# tinker_cookbook.stores.IncrementalReader

## _class_ [**tinker_cookbook.stores.IncrementalReader**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L22)()

Reads a JSONL file incrementally, tracking the byte offset.

Only new bytes since the last `read()` are parsed. Memory is bounded to `max_records` — oldest records are dropped when the limit is hit.

Uses `Storage.read_range()` for efficient partial reads.

Thread-safe: a `threading.Lock` protects all mutations so concurrent SSE connections sharing the same [`TrainingRunStore`](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/stores/trainingrunstore/) don't race.

Created lazily by stores to preserve pickle-serializability of the parent store object.

### _property_ [**records**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L48)

All buffered records (copy). Bounded by `max_records`.

**Returns:** _list[dict[str, Any]_]

### _property_ [**total_read**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L54)

Total number of records read since creation (not bounded by max_records).

**Returns:** _int_

### _property_ [**known_keys**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L60)

All metric keys seen (excluding 'step').

**Returns:** _set[str]_

### [**read**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L65)()

Read new lines since last call. Returns only new records.

**Returns:** _list[dict[str, Any]_]

### [**aread**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L109)()

Async version of `read()`.

**Returns:** _list[dict[str, Any]_]

### [**has_data**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/stores/_incremental.py#L113)()

Return `True` if records exist in memory or on disk.

**Returns:** _bool_

## Referenced by

- [tinker_cookbook.stores.FsspecStorage](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/stores/fsspecstorage/)
