Home

Awesome

Lite Transaction File (LTX)

The LTX file format provides a way to store SQLite transactional data in a way that can be encrypted and compacted and is optimized for performance.

File Format

An LTX file is composed of several sections:

  1. Header
  2. Page block
  3. Trailer

The header contains metadata about the file, the page block contains page frames, and the trailer contains checksums of the file and the database end state.

Header

The header provides information about the number of page frames as well as database information such as the page size and database size. LTX files can be compacted together so each file contains the transaction ID (TXID) range that it represents. A timestamp provides users with a rough approximation of the time the transaction occurred and the checksum provides a basic integrity check.

OffsetSizeDescription
04Magic number. Always "LTX1".
44Flags. Reserved. Always 0.
84Page size, in bytes.
124Size of DB after transaction, in pages.
164Database ID.
208Minimum transaction ID.
288Maximum transaction ID.
368Timestamp (Milliseconds since epoch)
448Pre-apply DB checksum (CRC-ISO-64)
5248Reserved.

Page block

This block stores a series of page headers and page data.

OffsetSizeDescription
04Page number.
4NPage data.

Trailer

The trailer provides checksum for the LTX file data, a rolling checksum of the database state after the LTX file is applied, and the checksum of the trailer itself.

OffsetSizeDescription
08Post-apply DB checksum (CRC-ISO-64)
88File checksum (CRC-ISO-64)