35#include <unordered_map>
38namespace neograph {
class HookRuntime; }
39namespace sp {
class NativeArchive; }
41namespace neograph::graph {
45namespace detail {
struct SubgraphWriteJournal; }
49 std::string owner_scope;
52 std::shared_ptr<CancelToken> cancellation;
53 std::optional<std::chrono::system_clock::time_point> parent_deadline;
66 std::string checkpoint_id;
68 std::shared_ptr<const NativeGraphCheckpoint> native_history;
75 std::vector<std::string> next_nodes;
126 std::string thread_id,
127 std::shared_ptr<::neograph::HookRuntime> hook_runtime = {},
129 std::shared_ptr<sp::NativeArchive> native_archive = {},
130 std::shared_ptr<detail::SubgraphWriteJournal> native_journal = {});
132 void set_managed_budget_lease(std::shared_ptr<OwnedManagedBudgetLease> lease);
135 bool enabled() const noexcept {
return store_ !=
nullptr && !thread_id_.empty(); }
144 return enabled() && !parent_cp_id.empty();
147 const std::shared_ptr<CheckpointStore>& store() const noexcept {
return store_; }
148 const std::string& thread_id() const noexcept {
return thread_id_; }
155 const std::string& current_node,
156 const std::vector<std::string>& next_nodes,
159 const std::string& parent_id,
183 std::string checkpoint_id)
const;
193 const std::string& task_id,
194 const std::string& task_path,
195 const std::string& node_name,
215 asio::awaitable<std::string> save_super_step_async(
217 const std::string& current_node,
218 const std::vector<std::string>& next_nodes,
221 const std::string& parent_id,
228 const std::string& current_node,
229 const std::vector<std::string>& next_nodes,
232 const std::string& parent_id,
234 const json& metadata)
const;
242 const std::string& current_node,
243 const std::vector<std::string>& next_nodes,
245 const std::string& parent_id,
247 const json& metadata = json())
const;
249 asio::awaitable<void> record_pending_write_async(
250 const std::string& parent_cp_id,
251 const std::string& task_id,
252 const std::string& task_path,
253 const std::string& node_name,
257 asio::awaitable<void> clear_pending_writes_async(
258 const std::string& parent_cp_id)
const;
261 asio::awaitable<void> publish_checkpoint_async(
const Checkpoint& checkpoint)
const;
264 std::shared_ptr<CheckpointStore> store_;
265 std::string thread_id_;
266 std::shared_ptr<::neograph::HookRuntime> hook_runtime_;
268 std::shared_ptr<sp::NativeArchive> native_archive_;
269 std::shared_ptr<detail::SubgraphWriteJournal> native_journal_;
270 std::shared_ptr<OwnedManagedBudgetLease> managed_budget_lease_;
271 bool native_memory_ =
false;
NEOGRAPH_API export/import macro for shared-library builds.
Checkpoint system for graph execution state persistence and time-travel.
CheckpointPhase
Phase at which a Checkpoint was produced.
Per-run coordinator for checkpoint lifecycle operations.
asio::awaitable< std::string > save_super_step_async(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 json &metadata) const
Internal extension used by subgraph execution to persist its cumulative write journal without changin...
ResumeContext load_for_resume() const
Load the latest checkpoint + all pending writes attached to it.
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.
asio::awaitable< Checkpoint > commit_super_step_async(const GraphState &state, const std::string ¤t_node, const std::vector< std::string > &next_nodes, int step, const std::string &parent_id, const BarrierState &barrier_state, const json &metadata=json()) const
Persist one completed super-step, settle the prior pending-write bucket, and return the exact deeply ...
bool records_pending_writes(const std::string &parent_cp_id) const noexcept
True when record_pending_write[_async] would store something: the coordinator is enabled and the step...
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.
CheckpointCoordinator(std::shared_ptr< CheckpointStore > store, std::string thread_id, std::shared_ptr<::neograph::HookRuntime > hook_runtime={}, CheckpointHookContext hook_context={}, std::shared_ptr< sp::NativeArchive > native_archive={}, std::shared_ptr< detail::SubgraphWriteJournal > native_journal={})
bool enabled() const noexcept
asio::awaitable< ResumeContext > load_for_resume_by_id_async(std::string checkpoint_id) const
Load one exact checkpoint and its pending writes by ID.
asio::awaitable< ResumeContext > load_for_resume_async() const
Async peer of load_for_resume (Sem 3.7.5).
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.
Abstract interface for checkpoint persistence backends.
Thread-safe container for all graph state channels.
NEOGRAPH_API void 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 > resume_pending_writes(CheckpointStore &store, const Checkpoint &checkpoint)
The pending writes that resuming checkpoint replays (#390).
Graph engine type definitions: channels, edges, nodes, events, and control flow.
Pure routing / next-step-planning logic extracted from GraphEngine.
std::map< std::string, std::set< std::string > > BarrierState
Per-barrier signal bookkeeping.
Per-attempt host identity and control inherited by checkpoint hook delivery.
Serialized snapshot of graph execution state at a single super-step.
Extended result returned by node execution.
Context needed to resume execution from the last saved snapshot.
std::shared_ptr< const Checkpoint > managed_budget_source
Exact loaded source retained for the standalone bank head commitment.
json metadata
Checkpoint metadata including lifecycle guard.
BarrierState barrier_state
Barrier accumulators for in-flight AND-joins.
json channel_values
Serialized GraphState at cp time.
std::string current_node
The checkpoint's current_node: for a Before checkpoint, the node whose interrupt_before gate saved it...
std::unordered_map< std::string, NodeResult > replay_results
Partially-completed super-step writes, keyed by task_id.
int start_step
Phase-adjusted step to re-enter at.