NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::CheckpointCoordinator Class Reference

Per-run coordinator for checkpoint lifecycle operations. More...

#include <coordinator.h>

Public Member Functions

 CheckpointCoordinator (std::shared_ptr< CheckpointStore > store, std::string thread_id)
 
void clear_pending_writes (const std::string &parent_cp_id) const
 Drop the pending-writes log for a parent cp after its super-step has been successfully committed.
 
bool enabled () const noexcept
 
ResumeContext load_for_resume () const
 Load the latest checkpoint + all pending writes attached to it.
 
asio::awaitable< ResumeContextload_for_resume_async () const
 Async peer of load_for_resume (Sem 3.7.5).
 
void record_pending_write (const std::string &parent_cp_id, const std::string &task_id, const std::string &task_path, const std::string &node_name, const NodeResult &nr, int step) const
 Durably record a completed node's writes under parent_cp_id.
 
std::string save_super_step (const GraphState &state, const std::string &current_node, const std::vector< std::string > &next_nodes, CheckpointPhase phase, int step, const std::string &parent_id, const BarrierState &barrier_state) const
 Write a super-step snapshot.
 

Detailed Description

Per-run coordinator for checkpoint lifecycle operations.

Value type; construct one at the top of execute_graph and let it go out of scope when the run ends. Holds no state beyond the store handle + thread_id.

Definition at line 75 of file coordinator.h.

Constructor & Destructor Documentation

◆ CheckpointCoordinator()

neograph::graph::CheckpointCoordinator::CheckpointCoordinator ( std::shared_ptr< CheckpointStore store,
std::string  thread_id 
)
Parameters
storeCheckpoint store (may be nullptr — everything is a no-op).
thread_idPer-run thread identifier (may be empty — same effect).

Member Function Documentation

◆ clear_pending_writes()

void neograph::graph::CheckpointCoordinator::clear_pending_writes ( const std::string &  parent_cp_id) const

Drop the pending-writes log for a parent cp after its super-step has been successfully committed.

Ordering matters: callers must have called save_super_step for a fresh cp BEFORE invoking this. Clearing before saving would lose data if a crash landed between the two calls.

◆ enabled()

bool neograph::graph::CheckpointCoordinator::enabled ( ) const
inlinenoexcept
Returns
True iff a non-null store is wired up AND thread_id is non-empty.

Definition at line 83 of file coordinator.h.

◆ load_for_resume()

ResumeContext neograph::graph::CheckpointCoordinator::load_for_resume ( ) const

Load the latest checkpoint + all pending writes attached to it.

Computes the phase-adjusted start step: before / node_interrupt re-enter AT cp.step (the node hadn't finished yet), after / completed advance by +1 (routing already happened).

◆ load_for_resume_async()

asio::awaitable< ResumeContext > neograph::graph::CheckpointCoordinator::load_for_resume_async ( ) const

Async peer of load_for_resume (Sem 3.7.5).

Uses load_latest_async + get_writes_async on the store so the resume path doesn't block the io_context's worker.

◆ record_pending_write()

void neograph::graph::CheckpointCoordinator::record_pending_write ( const std::string &  parent_cp_id,
const std::string &  task_id,
const std::string &  task_path,
const std::string &  node_name,
const NodeResult nr,
int  step 
) const

Durably record a completed node's writes under parent_cp_id.

Must be called BEFORE the writes are applied to GraphState — a crash between record and apply leaves a replayable log that makes resume idempotent.

◆ save_super_step()

std::string neograph::graph::CheckpointCoordinator::save_super_step ( const GraphState state,
const std::string &  current_node,
const std::vector< std::string > &  next_nodes,
CheckpointPhase  phase,
int  step,
const std::string &  parent_id,
const BarrierState barrier_state 
) const

Write a super-step snapshot.

Returns
The new checkpoint id, or empty string when disabled.

The documentation for this class was generated from the following file: