Relational NT
A relational database kernel shaped around NT-style object management.
Loading...
Searching...
No Matches
Types.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <unordered_map>
6#include <ranges>
7
12
94
106
114
122
123namespace nt {
125 struct Attribute {
126 std::string name;
127 std::string value;
128 };
129
136 class Tuple {
137 public:
138 explicit Tuple(std::vector<Attribute> attributes) {
139 for (auto &attr : attributes) attributes_[attr.name] = attr.value;
140 this->Reset();
141 }
142
144 const Attribute* Next() {
145 if (iter_ == attributes_.end()) return nullptr;
146 current_attr_ = {iter_->first, iter_->second};
147 iter_++;
148 return &current_attr_;
149 }
150
151 void Reset() {
152 iter_ = attributes_.begin();
153 }
154
155 const std::string operator[](std::string key) {
156 return attributes_[key];
157 }
158
159 const auto attrs() const {
160 auto view =
161 attributes_ |
162 std::views::transform([](std::pair<std::string, std::string> p) {
163 Attribute attr { p.first, p.second };
164 return attr;
165 });
166 return view;
167 }
168
169 private:
170 std::unordered_map<std::string, std::string> attributes_{};
171 std::unordered_map<std::string, std::string>::iterator iter_;
172 Attribute current_attr_;
173 };
174} // namespace nt
OBJECT_TYPE
Runtime object categories known by the object manager.
Definition Types.h:14
@ EPHEMERAL_RELATION
A relation whose tuples are produced on demand by a generator function rather than read from physical...
Definition Types.h:48
@ TRANSACTION
A transaction object.
Definition Types.h:22
@ BRANCH_TREE
The content-addressed Merkle<string> root of a branch's multigroup map.
Definition Types.h:92
@ RELATION
A relation object backed by physical storage.
Definition Types.h:18
@ MULTIGROUP
A database snapshot grouping relations and tuples.
Definition Types.h:16
@ ATTRIBUTE
An attribute object (schema metadata).
Definition Types.h:20
@ BRANCH
A named mutable reference to a multigroup snapshot, analogous to a git branch.
Definition Types.h:63
@ SESSION
A per-connection runtime context.
Definition Types.h:78
AUTH_METHOD
Authentication strategies supported by the permissions layer.
Definition Types.h:116
@ PLAIN_TEXT
Plain-text authentication.
Definition Types.h:120
@ CERTIFICATE
Certificate-based authentication.
Definition Types.h:118
AUTH_CLAIM
Claims granted to an authenticated connection.
Definition Types.h:108
@ WRITE
Permission to mutate object state.
Definition Types.h:112
@ READ
Permission to read object state.
Definition Types.h:110
METHOD
Operations that may be supported by an object type.
Definition Types.h:96
@ OPEN
Opens an object and creates an authorized handle.
Definition Types.h:98
@ SECURITY
Performs security checks.
Definition Types.h:104
@ CLOSE
Closes a previously opened handle.
Definition Types.h:100
@ PARSE
Parses through a secondary namespace.
Definition Types.h:102
const Attribute * Next()
Returns the next attribute, or nullptr when exhausted.
Definition Types.h:144
Contains the Relational NT runtime managers and API facade.
A single named value in a tuple, produced by the cursor layer.
Definition Types.h:125