3.1. File Format

3.1.2. Compact number format

Log entries use a compact number format for string length, record id, table id, and field id. This format allows very large values, but still takes very little space for small values.

Bytes of compact numbers are stored with the most significant bytes first. The number of extra bytes is stored in the 3 high-order bits of the first byte. Numbers between 0 and 31 included are stored as one byte. At most 61 bits can be stored.

Here are some examples

Number Compact representation
0 00
1 01
2 02
 
31 1f
32 20 20
33 20 21
 
256 21 00
 
8191 3f ff
8192 40 20 00
 

3.1.3. Log Entry

See joedb/journal/Readonly_Journal.cpp.