Expand description
State patches of a cold segment, stored only where the metadata doesn’t give them.
A ledger’s metadata names every object its transactions touched. The object
after the last of them follows from that node: FinalFields or NewFields,
LedgerEntryType, and this transaction as PreviousTxnID and
PreviousTxnLgrSeq if the object is threaded. What the node leaves out is
added by a few rules (defaults): xrpld doesn’t list a field at its default
value when it creates an object, and it never lists a directory’s Indexes,
though a new page usually holds just the object its transaction created. A
deleted object has no data, and one created and deleted in the same ledger has
no patch at all. Most of a ledger’s patches come back exactly, and most of
the others up to a few fields.
A stored ledger starts with an entry under the zero key that says how to read the rest:
DERIVEDand the directory rule: an entry(key, value)follows only for what isn’t restored. For a key the metadata doesn’t name,valueis the patch as it is. For a key it names, byvalue: empty, the object is deleted;NO_PATCH, the ledger has no patch for it;WHOLEand the data, the patch as it is; otherwise the fields that are missing or different, in canonical order. Patches come back sorted by key;AS_IS: every patch follows as it is. A ledger gets this when it doesn’t come back exactly the other way (unsorted patches, metadata that can’t be read).
A row without that entry was written before this format and holds every patch. The entry is in the row and not in the manifest so that a reader can’t pair a rule with the wrong archive while a segment is being rewritten under it. Object keys are hashes, so none of them is zero.
Only Row::patches changes, and only reading the patches needs this: transactions
are read as before.
Directories were not threaded until the fixPreviousTxnID amendment, and nothing in the metadata says which rule a ledger followed, so each ledger keeps the rule that stores less.
These rules are fixed: DERIVED names them. Changing them means a new
marker, with this one still read.