Skip to main content

Module consol

Module consol 

Source
Expand description

The map a swap leaves in output.consol, and what reads it: how a position in the old file (a counted line, or a byte) is the same position in the new one (SPEC_HISTORY_COMPACT_FORM_ONLY_2026_11_23.md section 9).

A swap drops only fragment lines and blank lines, writes interrupted lines in place of fragments and copies everything else as it was, so the whole change is a list of runs: where a run of old lines (or bytes) stood, how many there were, and how many take their place. Inside a kept line a position moves exactly; inside a run it moves to where the run started, so a reader that was in the middle of dropped fragments sees the interrupted line, or the next kept line, and never a piece of a line.

Structs§

ByteRun
The same run in bytes, which also holds the blank lines that were not carried over.
Map
One swap’s map: from the file of generation gen_before to the file of gen_after.
Run
A run of counted old lines the compact form dropped, and what stands in their place.

Constants§

CONSOL
The file the swaps are recorded in.

Functions§

chain
The swaps that took the file from generation from to to, in order, or None when the record does not hold an unbroken chain (a swap too old to be kept, or a rewrite that was no swap).
maps
The swaps recorded for zone, oldest first. A line that is not a map is skipped. Empty when there are none or the record cannot be read.
translate_byte
A byte offset of the file of generation from, in the file of generation to.
translate_line
A counted line number of the file of generation from, in the file of generation to.