NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
checkpoint.h File Reference

Checkpoint system for graph execution state persistence and time-travel. More...

#include <neograph/api.h>
#include <neograph/graph/types.h>
#include <asio/awaitable.hpp>
#include <cstdint>
#include <optional>
#include <mutex>
#include <map>
#include <set>
#include <vector>
#include <string_view>
#include <chrono>
Include dependency graph for checkpoint.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  neograph::graph::Checkpoint
 Serialized snapshot of graph execution state at a single super-step. More...
 
class  neograph::graph::CheckpointStore
 Abstract interface for checkpoint persistence backends. More...
 
class  neograph::graph::InMemoryCheckpointStore
 In-memory checkpoint store for testing and single-process use. More...
 
struct  neograph::graph::PendingWrite
 Successful node writes recorded within an in-progress super-step. More...
 

Enumerations

enum class  neograph::graph::CheckpointPhase {
  Before , After , Completed , NodeInterrupt ,
  Updated
}
 Phase at which a Checkpoint was produced. More...
 

Functions

NEOGRAPH_API CheckpointPhase neograph::graph::parse_checkpoint_phase (std::string_view s)
 Parse a phase string back to the enum.
 
NEOGRAPH_API const char * neograph::graph::to_string (CheckpointPhase phase)
 Canonical wire / log string for a CheckpointPhase.
 

Variables

constexpr std::uint32_t neograph::graph::CHECKPOINT_SCHEMA_VERSION = 2
 Current Checkpoint layout version.
 

Detailed Description

Checkpoint system for graph execution state persistence and time-travel.

Provides the Checkpoint data structure and the CheckpointStore interface for saving and loading execution state snapshots. Used for HITL (Human-in-the-Loop) interrupt/resume, time-travel debugging, and thread forking.

Definition in file checkpoint.h.

Enumeration Type Documentation

◆ CheckpointPhase

Phase at which a Checkpoint was produced.

Drives resume semantics — Before means "re-enter before the target node runs", After / Completed means "routing has already happened, advance from the stored next_nodes", NodeInterrupt means "a node threw NodeInterrupt mid-execution", Updated means "user patched state out-of-band via update_state()".

Enumerator
Before 

Saved just before an interrupt_before node fires.

After 

Saved just after an interrupt_after node completed.

Completed 

Saved at end of super-step (normal cadence).

NodeInterrupt 

Saved when a node threw NodeInterrupt.

Updated 

Saved by update_state() injecting state externally.

Definition at line 53 of file checkpoint.h.

Function Documentation

◆ parse_checkpoint_phase()

NEOGRAPH_API CheckpointPhase neograph::graph::parse_checkpoint_phase ( std::string_view  s)

Parse a phase string back to the enum.

Useful for deserializing checkpoints from persistent stores. Unknown strings throw std::invalid_argument — deliberate, because silent fallback would mask wire-format drift.

References neograph::graph::parse_checkpoint_phase().

Referenced by neograph::graph::parse_checkpoint_phase().

◆ to_string()

NEOGRAPH_API const char * neograph::graph::to_string ( CheckpointPhase  phase)

Canonical wire / log string for a CheckpointPhase.

The returned value is the same as the legacy stringly-typed phase so persistent stores serializing with to_string() produce identical blobs to pre-enum NeoGraph.

References neograph::graph::to_string().

Referenced by neograph::graph::to_string().

Variable Documentation

◆ CHECKPOINT_SCHEMA_VERSION

constexpr std::uint32_t neograph::graph::CHECKPOINT_SCHEMA_VERSION = 2
constexpr

Current Checkpoint layout version.

Bump whenever the on-wire schema changes in a way that would break a naive load of an older blob.

Version log: 1 — first versioned format. next_nodes is vector<string> (previously a single next_node string; the string form is unversioned and predates this constant). 2 — added barrier_state: per-barrier accumulator of upstream signals received so far. v1 blobs deserialize with an empty map, which is safe — a barrier that had partial signals under v1 would have lost them anyway (the pre-v2 contract), so the v2 engine simply resumes with zero accumulated signals and waits for the full set again.

Definition at line 45 of file checkpoint.h.