Skip to main content

Module coldindex

Module coldindex 

Source
Expand description

Cold history indexes for the API: transaction by hash (XTXH), account history (XACC v2) and ledger hash → sequence, over a contiguous range of cold segments (a partition). There can be several partitions; queries walk them in order.

Files of the partition whose first ledger is F: coldidx-F.xtxh, coldidx-F.xacc, coldidx-F.lgr (XWLH\0\1, u32 count, then the header hash and sequence in ascending hash order) and the manifest coldidx-F.json, written last via a temporary file and rename. They are read from disk (txindex::TxHashFile, AccountFile). Memory holds only the per-ledger start offsets, a sparse account directory and a sparse table of ledger hashes (every LGR_SPARSE-th); for the full history that is tens of megabytes rather than gigabytes.

Building is a single pass over the cold ledgers: the header chain is checked, account lists are verified against the in-memory index before writing, and every transaction is looked up through the file after writing.

Structs§

ColdIndex
An index partition.
ColdIndexes
Index partitions in a directory, in ascending order.

Functions§

build
Builds an index partition for cold ledgers first..=last and publishes it with a manifest. Returns the manifest.

Type Aliases§

Shared
Indexes next to the cold segments of a directory, shared between readers.