Saves
What a script author sees of saving is in Saving and migration; this page is how it is built.
Checkpoints
- A checkpoint is one record, and the host writes it in one compare-and-swap together with its
own world data. Through the C interface it is
{"kalem": …, "fields": {object: {key: value}}}. - It holds the world's fields; every instance's memory, current state, started timers and random-number state; the closed bindings and their errors; the world's clock and the order counters.
- It is taken only at a minute's boundary, when all of that minute's work is done: the event queue is empty then and is not saved. No checkpoint is taken while the debugger holds a transaction.
- To replay, the outside events and clock steps after a checkpoint go into a separate input log.
- The format is versioned (today 1); indexes are 32-bit; there is no shared string pool.
Definition packages
- A save carries the revision of the definitions it was made with. The package holds the compiled scripts (with the compiler's version), every binding's resolved property values, the objects' contracts, the event schemas used, and the versions of the type mapping (ABI), the execution rules, the bytecode format and the native schema.
- The revision is the SHA-256 of the package, the host's contracts and the rule versions. The same definitions opened by a version with other rules get another revision, and the save is not loaded: that is a migration.
- Packages are stored by their content, so an old save can always be opened with its own package and its inputs replayed.