NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
postgres_store.h
Go to the documentation of this file.
1
5#pragma once
6
8
9#include <memory>
10#include <string>
11#include <string_view>
12
13namespace neograph::program {
14
22class NEOGRAPH_PROGRAM_API PostgreSQLProgramStore final : public SyncProgramStore {
23public:
24 explicit PostgreSQLProgramStore(std::string connection_string);
28 PostgreSQLProgramStore& operator=(const PostgreSQLProgramStore&) = delete;
29 ~PostgreSQLProgramStore() override;
30
31 void publish_admitted_sync(const ProgramBundle& bundle, const ProgramVersion& version) override;
32 std::optional<ProgramBundle> get_bundle_sync(std::string_view id) const override;
33 std::optional<ProgramVersion> get_version_sync(std::string_view id) const override;
34 std::optional<ProgramBundle> get_bundle_sync(std::string_view owner_scope,
35 std::string_view id) const override;
36 std::optional<ProgramVersion> get_version_sync(std::string_view owner_scope,
37 std::string_view id) const override;
38 std::optional<ProgramActivation>
39 get_activation_sync(std::string_view owner_scope) const override;
40 std::optional<ProgramActivationBinding>
41 get_active_binding_sync(std::string_view owner_scope) const override;
42 ProgramActivationResult compare_activate_sync(std::string_view owner_scope,
43 std::uint64_t expected_generation,
44 std::string_view version_id,
45 std::string_view policy_snapshot_hash) override;
46 std::vector<ProgramVersion> list_versions_sync(std::string_view owner_scope) const override;
47 ProgramRetentionReport collect_garbage_sync(
48 std::string_view owner_scope,
49 const std::vector<std::string>& pinned_version_ids) override;
50
51protected:
53 bool offloads() const noexcept override { return true; }
54
55private:
56 struct Impl;
57 std::unique_ptr<Impl> impl_;
58};
59
60} // namespace neograph::program
ProgramActivationResult
Result of an atomic owner-scoped activation compare-and-swap.
Definition activation.h:20
Transactional PostgreSQL implementation of ProgramStore.
bool offloads() const noexcept override
libpq blocks for long: an awaited operation runs on a thread of the bounded pool (#556).
Base of a ProgramStore whose backend is synchronous: the in-memory store, SQLite and PostgreSQL.
Definition store.h:123
Atomic storage of admitted Program bundles and versions.
Counts immutable records removed by reference-aware collection.
Definition activation.h:68