NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
handle.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <neograph/api.h>
12
13#include <asio/awaitable.hpp>
14
15#include <cstdint>
16#include <memory>
17#include <optional>
18#include <string>
19#include <vector>
20
21namespace neograph::program {
22
23namespace detail {
24class RunControl;
25}
26class ProgramRuntime;
27struct ProgramResume;
28struct ProgramEffectResolution;
29
37 std::string code;
39 std::string message;
41 json witness;
42
43 bool operator==(const ProgramNotice&) const = default;
44};
45
46class NEOGRAPH_PROGRAM_API ProgramHandle {
47public:
48 ProgramHandle(const ProgramHandle&) noexcept = default;
49 ProgramHandle& operator=(const ProgramHandle&) noexcept = default;
50 ProgramHandle(ProgramHandle&&) noexcept = default;
51 ProgramHandle& operator=(ProgramHandle&&) noexcept = default;
52 ~ProgramHandle();
53
54 const std::string& run_id() const noexcept;
56 const std::string& logical_run_id() const noexcept;
57 const std::string& program_version_id() const noexcept;
58 std::uint64_t attempt() const noexcept;
59
67 bool cancel() noexcept;
68 ProgramResult wait() const;
69 asio::awaitable<ProgramResult> wait_async() const;
70 std::optional<ProgramResult> try_result() const;
71 std::vector<ProgramEvent> events_after(std::uint64_t sequence) const;
72 std::optional<CoreCheckpointIdentity> latest_checkpoint() const;
74 std::optional<ExactProgramHandoff> latest_handoff() const;
76 ProgramHandoff next_handoff() const;
81 asio::awaitable<ProgramHandoff> next_handoff_async() const;
82 ProgramRunRecord snapshot() const;
88 asio::awaitable<bool> cancel_async();
89 asio::awaitable<std::optional<ExactProgramHandoff>> latest_handoff_async() const;
90 asio::awaitable<ProgramRunRecord> snapshot_async() const;
118 std::vector<ProgramNotice> notices() const;
119 ProgramHandle resume(ProgramRuntime& runtime, ProgramResume resume) const;
120 ProgramHandle reconcile(ProgramRuntime& runtime,
121 ProgramEffectResolution resolution) const;
122
123private:
124 explicit ProgramHandle(std::shared_ptr<detail::RunControl> control);
125 std::shared_ptr<detail::RunControl> control_;
126
127 friend class ProgramRuntime;
128};
129
130} // namespace neograph::program
NEOGRAPH_API export/import macro for shared-library builds.
Move-only host lease holding a source generator at an exact durable checkpoint.
Definition replacement.h:45
Deep-owned, content-addressed run snapshot used for reconnect and CAS publication.
Definition run_record.h:119
Ordered event envelope for one Program run attempt.
Exact durable handoff receipts for Program generation replacement.
Immutable outcome of one Program run attempt.
Canonical immutable snapshot of one owner-scoped Program run.
A fact about how the runtime started a run that the caller should know.
Definition handle.h:35
std::string code
Stable identifier, for example P_FORK_PROVIDER_CALLS_NOT_JOURNALED.
Definition handle.h:37
std::string message
One sentence for a person.
Definition handle.h:39
json witness
The facts the message summarizes, as JSON.
Definition handle.h:41