On this page· 3

What a pack is

  • file format 6
  • Rust SDK 1.0 preview

A pack is one PLXI file. It holds records about some things, the links between them, and, when recorded, where each came from. It is also sealed: its footer carries a digest of its contents, so a reader can tell whether anything changed.

The parts of a pack

Read from the first byte to the last, a pack has up to seven kinds of part. Each has a plain name on PLXI help and an exact name in the specification.

Figure 1 A pack, as a parcel and as bytes

Each plain name on the left is a part on the right. The finder is dashed because only some packs have an appendix.
Table 1. Parts of a pack: 7
#Plain name (PLXI help)In the fileWhat it holds
1cover lineheader line, bytes 0 to 256six tokens: the format version, the record count, where the appendix is, and the digest
2cover notea meta record, written firstwhen the pack was made and from what source
3cardsent recordsone thing each: an id, a type, and optional members such as a name
4linksrel recordsa named link from one thing to another
5tagsprov recordswhere a fact came from: the subject, the agent, the method and the time
6finderthe appendixbinary data that does not fit a JSON line, such as embedding rows
7sealthe footer, the last 96 bytescounts, offsets, and the SHA-256 digest of everything between the header line and the footer

Records are written in a fixed order by kind, so the meta record comes before the entities and the prov records come after the relations.

A pack does not need every part. The quickstart's pack has three records, two entities and one relation, and no appendix.

Text first, binary at the end

Everything a person can read is text: the header line is ASCII, and each record is one JSON object on one line. Binary data, when there is any, sits after the text, in one block aligned to 64 bytes.

A record can also point at binary data in another file, through a csdt_ref record. The Rust SDK reads such pointers but does not follow them. The appendix

What a pack is not

  • Not signed. The digest shows that bytes changed. It does not show who wrote the pack.
  • Not encrypted. Revision 6.0 of the format defines no encryption.
  • Not a database. A pack is written whole and read whole; the Rust SDK holds the whole pack in memory.
Sections