|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
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< ResumeContext > | load_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 ¤t_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. | |
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.
| neograph::graph::CheckpointCoordinator::CheckpointCoordinator | ( | std::shared_ptr< CheckpointStore > | store, |
| std::string | thread_id | ||
| ) |
| store | Checkpoint store (may be nullptr — everything is a no-op). |
| thread_id | Per-run thread identifier (may be empty — same effect). |
| 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.
|
inlinenoexcept |
Definition at line 83 of file coordinator.h.
| 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).
| 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.
| 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.
| 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.