NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
safe_point.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <neograph/api.h>
9
10#include <memory>
11#include <optional>
12#include <string>
13
14namespace neograph::graph {
15
16class GraphEngine;
17class CancelToken;
18
21 std::string core_name;
22 std::string core_generation_id;
23
24 bool operator==(const GraphGenerationIdentity&) const = default;
25};
26
28class NEOGRAPH_API GraphSafePoint final {
29public:
30 GraphSafePoint(const GraphSafePoint&) = default;
31 GraphSafePoint& operator=(const GraphSafePoint&) = default;
32
33 const GraphGenerationIdentity& generation() const noexcept;
34 const Checkpoint& checkpoint() const noexcept;
35
36private:
37 struct Impl;
39 std::shared_ptr<const Impl> impl_;
40
41 friend class GraphSafePointRequest;
42};
43
51class NEOGRAPH_API GraphSafePointRequest final {
52public:
53 explicit GraphSafePointRequest(GraphGenerationIdentity expected_generation);
55 GraphSafePointRequest& operator=(const GraphSafePointRequest&) = delete;
57
59 bool request() noexcept;
60 bool requested() const noexcept;
61 bool captured() const noexcept;
62 bool closed() const noexcept;
63 GraphGenerationIdentity expected_generation() const;
64 std::optional<GraphSafePoint> safe_point() const;
65
66private:
67 struct Impl;
68 std::unique_ptr<Impl> impl_;
69
70 bool attach(const GraphGenerationIdentity& generation) noexcept;
71 bool capture(const GraphGenerationIdentity& generation,
72 Checkpoint checkpoint,
73 const CancelToken* cancellation);
74 void close() noexcept;
75 void reject() noexcept;
76
77 friend class GraphEngine;
78};
79
80} // namespace neograph::graph
NEOGRAPH_API export/import macro for shared-library builds.
Checkpoint system for graph execution state persistence and time-travel.
Cooperative cancel primitive shared between caller and engine.
Definition cancel.h:82
Super-step loop execution engine for graph-based agent workflows.
Definition engine.h:648
One-shot host controller for stopping at the next completed super-step.
Definition safe_point.h:51
bool request() noexcept
Arm this controller.
Immutable snapshot exposed only after a completed super-step is durable.
Definition safe_point.h:28
Serialized snapshot of graph execution state at a single super-step.
Definition checkpoint.h:173
Exact host-supplied identity permanently bound to one linked engine.
Definition safe_point.h:20