Checkpointer

interface Checkpointer<State>

Persists the checkpoints of each thread so a run can pause and resume later, even in a different process.

A checkpointer has to keep the latest checkpoint of a thread. One that also keeps the earlier ones implements history, and CompiledGraph.history and CompiledGraph.fork can then go back to an earlier step. The checkpointers of this library do; withCheckpoint has the rule for a checkpointer of your own.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun delete(threadId: String)

Removes every checkpoint of threadId. Does nothing if the thread has none.

Link copied to clipboard
open suspend fun history(threadId: String): List<Checkpoint<State>>

Returns the checkpoints that threadId still has, oldest first, ending with the one that load returns. Empty if the thread has none.

Link copied to clipboard
abstract suspend fun load(threadId: String): Checkpoint<State>?

Returns the latest checkpoint of threadId, or null if the thread has none.

Link copied to clipboard
abstract suspend fun save(threadId: String, checkpoint: Checkpoint<State>)

Stores checkpoint as the latest checkpoint of threadId.