Checkpointer

org.llm4s.agent.graph.Checkpointer
trait Checkpointer

Durable storage for graph threads: each thread's latest checkpoint, the pending writes recorded against it, and its durable event log. One store owns all three so that a commit is atomic.

Implementations must be safe to call from several threads, and must:

  • apply a Commit entirely or not at all;
  • accept a new checkpoint only when its parent is the thread's latest checkpoint id (GraphError.CheckpointConflict otherwise), and only pending writes naming the resulting latest checkpoint (GraphError.InvalidCommit);
  • number a thread's events 1, 2, 3, ... in commit order, inside the commit, never reusing a number - including after compaction or a failed commit;
  • keep events until compactEvents removes them, and report the earliest sequence still available when asked to replay from before it (GraphError.ReplayUnavailable).

Fencing a commit with a run-claim token is Stage 2; the parent check is its precursor.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def commit(threadId: ThreadId, commit: Commit): Result[Vector[EventRecord]]

Applies commit atomically and returns its events with their sequence numbers.

Applies commit atomically and returns its events with their sequence numbers.

Attributes

def compactEvents(threadId: ThreadId, beforeSeq: Long): Result[Unit]

Drops events with seq < beforeSeq; replay can then start no earlier than beforeSeq.

Drops events with seq < beforeSeq; replay can then start no earlier than beforeSeq.

Attributes

def eventsAfter(threadId: ThreadId, afterSeq: Long, limit: Int): Result[Vector[EventRecord]]

Up to limit events with seq > afterSeq, ascending.

Up to limit events with seq > afterSeq, ascending.

Attributes

def latest(threadId: ThreadId): Result[Option[StoredCheckpoint]]

The thread's latest checkpoint and its pending writes; None for a new thread.

The thread's latest checkpoint and its pending writes; None for a new thread.

Attributes