FileCheckpointer
A persistent Checkpointer that stores the checkpoints of each thread in one file inside directory: one line of JSON for each step of the thread, oldest first.
Works on every target that has a file system: JVM/Android, Apple, Linux and Windows native, and JS/Wasm running on Node.js. It is not available in browsers.
Writes are atomic: a checkpoint is written to a temporary file and then moved into place, so a crash in the middle of a save leaves the previous checkpoints intact. One instance is safe to share between coroutines; do not point several instances or processes at the same directory.
A save writes the file of its thread again, with the whole history. Give a thread that runs for hundreds of steps a maxHistory.
Parameters
where checkpoint files are stored. Created if it does not exist.
converts the graph state to and from a string.
the file system to use; replaceable in tests.
how many checkpoints a thread keeps, counted from the latest. The default keeps all of them; 1 keeps only the latest.
Throws
if maxHistory is not positive.