aboutsummaryrefslogtreecommitdiffstats
path: root/include/VM.h
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-06-05 21:40:44 -0300
committerGitHub <noreply@github.com>2026-06-05 21:40:44 -0300
commit5174fc25698cff33b03b5746bf1742e417988f7d (patch)
tree232a3acdd9b458de481dbd5cbde889505168c8e8 /include/VM.h
parent85ed897de3676af866cc619dc700025820c02201 (diff)
downloadRNT-5174fc25698cff33b03b5746bf1742e417988f7d.tar.gz
RNT-5174fc25698cff33b03b5746bf1742e417988f7d.zip
Project C interface, reroute FOL plan enums & format
Diffstat (limited to '')
-rw-r--r--include/VM.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/include/VM.h b/include/VM.h
index 3bfe521..3d97779 100644
--- a/include/VM.h
+++ b/include/VM.h
@@ -14,8 +14,7 @@
* @brief Declares the logic execution boundary for relational and higher-order workloads.
*/
-namespace nt
-{
+namespace nt {
/**
* @class VM
* @brief Hosts the first-order logic (FOL) and second-order logic (SOL) cores.
@@ -64,15 +63,25 @@ namespace nt
* (for EPHEMERAL_RELATION cursors) or ignored (for stored RELATION cursors,
* which need no per-probe parameterization).
*/
- struct PathArg
- {
+ struct PathArg {
enum class Kind { Var, Const };
- Kind kind;
+ Kind kind;
std::string name; /**< Attribute name to look up (Var), or literal value (Const). */
- static PathArg Var(std::string attr) { return { Kind::Var, std::move(attr) }; }
- static PathArg Const(std::string val) { return { Kind::Const, std::move(val) }; }
+ static PathArg Var(std::string attr) {
+ return {Kind::Var, std::move(attr)};
+ }
+ static PathArg Const(std::string val) {
+ return {Kind::Const, std::move(val)};
+ }
+ };
+
+ enum Operation {
+ FOL_OPERATION_SCAN = 1,
+ FOL_OPERATION_JOIN,
+ FOL_OPERATION_TAKE,
+ FOL_OPERATION_PROJECT
};
/**
@@ -91,12 +100,9 @@ namespace nt
* this to bound scans over AlephZero ephemeral relations.
* - PROJECT: filters each input tuple to the named attributes in project_attrs.
*/
- struct PlanNode
- {
- enum class Op { SCAN, JOIN, TAKE, PROJECT };
-
- Op op;
- PlanNode* left = nullptr;
+ struct PlanNode {
+ Operation op;
+ PlanNode* left = nullptr;
PlanNode* right = nullptr;
/**
@@ -134,13 +140,12 @@ namespace nt
* successful join. Callers must consume the returned pointer before
* calling Next() again — same contract as a cursor page pointer.
*/
- Tuple* join_left = nullptr;
+ Tuple* join_left = nullptr;
std::optional<Tuple> join_buffer;
};
- class VM
- {
- public:
+ class VM {
+ public:
// TODO: CursorManager should be injected as a shared runtime instance,
// matching the pattern flagged for HandlerManager and LifecycleManager.
//
@@ -167,21 +172,19 @@ namespace nt
*/
Tuple* Next(PlanNode* node);
- private:
+ private:
CursorManager& cursors_;
/**
* Resolves a scan_args template against an outer tuple, producing the
* concrete args vector to write into the inner cursor before probing.
*/
- static std::vector<std::string> ResolveArgs(const std::vector<PathArg>& tmpl,
- Tuple* from);
+ static std::vector<std::string> ResolveArgs(const std::vector<PathArg>& tmpl, Tuple* from);
/** Resets the inner cursor state and writes resolved args into it. */
- static void ResetInner(CursorManager::cursor* c,
- std::vector<std::string> args);
+ static void ResetInner(CursorManager::cursor* c, std::vector<std::string> args);
/** Merges left and right tuple attributes into node->join_buffer. */
static Tuple* MergeInto(PlanNode* node, Tuple* left, Tuple* right);
};
-}
+} // namespace nt