NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
coordinator.h File Reference

CheckpointCoordinator — owns the super-step checkpoint lifecycle. More...

#include <neograph/api.h>
#include <neograph/graph/types.h>
#include <neograph/graph/checkpoint.h>
#include <neograph/graph/scheduler.h>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
Include dependency graph for coordinator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  neograph::graph::CheckpointCoordinator
 Per-run coordinator for checkpoint lifecycle operations. More...
 
struct  neograph::graph::CheckpointHookContext
 Per-attempt host identity and control inherited by checkpoint hook delivery. More...
 
struct  neograph::graph::ResumeContext
 Context needed to resume execution from the last saved snapshot. More...
 

Functions

NEOGRAPH_API void neograph::graph::copy_resume_pending_writes (CheckpointStore &store, const Checkpoint &source, const Checkpoint &target)
 Record under target the pending writes that resuming source replays (#390).
 
NEOGRAPH_API std::vector< PendingWrite > neograph::graph::resume_pending_writes (CheckpointStore &store, const Checkpoint &checkpoint)
 The pending writes that resuming checkpoint replays (#390).
 

Detailed Description

CheckpointCoordinator — owns the super-step checkpoint lifecycle.

Pulled out of GraphEngine::execute_graph so the three intertwined concerns that used to live there — snapshot write, resume-context load, and pending-writes log — each sit behind named methods with their own invariants. The coordinator is a thin, per-run wrapper over a CheckpointStore + thread_id pair:

  • save_super_step: build a Checkpoint, write it, return its id.
  • load_for_resume: pull the latest cp plus every pending write, and return a ResumeContext the engine can apply wholesale.
  • record_pending_write / clear_pending_writes: fine-grained progress log for partial-failure recovery.

When the backing store is nullptr or the thread_id is empty, every method is a safe no-op (save returns "", load returns an empty ResumeContext). Callers no longer need to guard on both conditions at every call site.

The coordinator does NOT touch admin APIs (get_state, update_state, fork) — those don't have a super-step boundary and continue to use CheckpointStore directly on GraphEngine.

Definition in file coordinator.h.

Function Documentation

◆ copy_resume_pending_writes()

NEOGRAPH_API void neograph::graph::copy_resume_pending_writes ( CheckpointStore &  store,
const Checkpoint &  source,
const Checkpoint &  target 
)

Record under target the pending writes that resuming source replays (#390).

target is a saved copy of source on another thread, such as a fork: it has the same super-step and does not reach source's ancestry. Resuming it then replays the nodes and Sends that finished in the paused step, exactly as resuming source does, instead of running them again. source keeps its own writes.

References neograph::graph::copy_resume_pending_writes().

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

◆ resume_pending_writes()

NEOGRAPH_API std::vector< PendingWrite > neograph::graph::resume_pending_writes ( CheckpointStore &  store,
const Checkpoint &  checkpoint 
)

The pending writes that resuming checkpoint replays (#390).

The writes recorded under the checkpoint and, for a NodeInterrupt checkpoint, the writes of its super-step recorded under its ancestors (the step's parent checkpoint, an earlier interrupt of the same step), stopping at a fork or migration boundary. One per task id, the nearest first: what CheckpointCoordinator::load_for_resume() replays.

References neograph::graph::resume_pending_writes().

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