RPNX::QueryGraph
Typed, memoized, concurrent query evaluation for C++23
Loading...
Searching...
No Matches
graphdata.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 Ryan P. Nicholl <rnicholl@protonmail.com>
2// See: doc/dump-file-format.md
3
4
5#ifndef RPNXQUERYGRAPH_GRAPHDATA_HPP
6#define RPNXQUERYGRAPH_GRAPHDATA_HPP
7
16#include "rpnx/macros.hpp"
17
18#include <array>
19#include <cstddef>
20#include <map>
21#include <optional>
22#include <string>
23#include <vector>
24
25
26RPNX_ENUM(rpnx::querygraph, status, std::uint8_t, pending, completed, canonical_error, unexpected_exception);
27
39namespace rpnx::querygraph
40{
42 using tsig = std::array< std::byte, 16 >;
43
56
59 {
61 std::string m_query_id;
63 std::vector< std::byte > m_input_data;
64
65 RPNX_MEMBER_METADATA(node_reference_data, m_query_id, m_input_data);
66 };
67
70 {
74 std::vector< std::byte > m_output_data;
76 std::optional< canonical_error_result_data > m_error_result;
77
79 };
80
93
96 {
100 std::vector< std::byte > m_output_data;
102 std::optional< canonical_error_result_data > m_error_result;
104 std::vector< std::string > m_messages;
106 std::vector< node_reference_data > m_dependencies;
108 std::map< std::string, subquery_class_data > m_subqueries;
109
111 };
112
115 {
121 std::map< std::vector< std::byte >, query_node_data > m_instances;
122
124 };
125
134 {
136 std::map< std::string, query_class_data > m_node_classes;
138 std::optional< node_reference_data > m_root_node;
139
140 RPNX_MEMBER_METADATA(graph_data, m_node_classes, m_root_node);
141 };
142} // namespace rpnx::querygraph
143
144#endif // RPNXQUERYGRAPH_GRAPHDATA_HPP
std::array< std::byte, 16 > tsig
Fixed-size RPNXSerialization type-signature digest.
Definition graphdata.hpp:42
status
Terminal or in-progress state recorded for a dumped result.
Definition graphdata.hpp:26
Serializable representation of a registered canonical error.
Definition graphdata.hpp:46
std::vector< std::byte > m_error_data
Exception value serialized through binary_traits.
Definition graphdata.hpp:50
tsig m_error_typesig
Type signature identifying the registered exception type.
Definition graphdata.hpp:48
std::string m_error_message
Human-readable message returned by std::exception::what().
Definition graphdata.hpp:52
Complete serializable snapshot of a QueryGraph instance.
std::map< std::string, query_class_data > m_node_classes
Query classes indexed by their stable query_id.
std::optional< node_reference_data > m_root_node
Selected root for a partial dump, if one was requested.
Serializable identity of a memoized query node.
Definition graphdata.hpp:59
std::vector< std::byte > m_input_data
Serialized query input that distinguishes the node instance.
Definition graphdata.hpp:63
std::string m_query_id
Stable query_id supplied by the query specification.
Definition graphdata.hpp:61
All memoized instances belonging to one query specification.
tsig m_output_typesig
Type signature for the query output type.
tsig m_input_typesig
Type signature for the query input type.
std::map< std::vector< std::byte >, query_node_data > m_instances
Nodes indexed by serialized query input.
Serialized state and outgoing edges of one memoized query node.
Definition graphdata.hpp:96
std::vector< node_reference_data > m_dependencies
Query nodes directly requested by this node.
std::optional< canonical_error_result_data > m_error_result
Canonical error payload when m_status is canonical_error.
std::map< std::string, subquery_class_data > m_subqueries
Produced or requested subquery classes indexed by subquery_id.
status m_status
Current result status.
Definition graphdata.hpp:98
std::vector< std::byte > m_output_data
Serialized output, or diagnostic bytes for an error.
std::vector< std::string > m_messages
Source-formatted diagnostic messages yielded by the handler.
All instances of one subquery specification under a parent node.
Definition graphdata.hpp:83
std::map< std::vector< std::byte >, subquery_instance_data > m_instances
Instances indexed by serialized subquery input.
Definition graphdata.hpp:89
tsig m_input_typesig
Type signature for the subquery input type.
Definition graphdata.hpp:85
tsig m_output_typesig
Type signature for the subquery output type.
Definition graphdata.hpp:87
Serialized state of one subquery input beneath a parent node.
Definition graphdata.hpp:70
std::vector< std::byte > m_output_data
Serialized output, or diagnostic bytes for an error.
Definition graphdata.hpp:74
status m_status
Current result status.
Definition graphdata.hpp:72
std::optional< canonical_error_result_data > m_error_result
Canonical error payload when m_status is canonical_error.
Definition graphdata.hpp:76