diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-09 23:03:00 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-09 23:03:00 -0300 |
| commit | c375b1c69665ae7c16ffa3f17264386dfc257d8e (patch) | |
| tree | c0a45b370512ae6d4b4a9500c244419567a357ef /include/CursorManager.h | |
| parent | 921de259fa441fb562aec701f0c8c14310f126e4 (diff) | |
| download | RNT-c375b1c69665ae7c16ffa3f17264386dfc257d8e.tar.gz RNT-c375b1c69665ae7c16ffa3f17264386dfc257d8e.zip | |
FOL VM with cursor mocked storage
Diffstat (limited to '')
| -rw-r--r-- | include/CursorManager.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/CursorManager.h b/include/CursorManager.h index 7e1ebe0..78ea24c 100644 --- a/include/CursorManager.h +++ b/include/CursorManager.h @@ -1,6 +1,12 @@ #pragma once #include "Api.h" +#include "HandlerManager.h" +#include "Types.h" + +#include <string> +#include <unordered_map> +#include <vector> /** * @file CursorManager.h @@ -35,5 +41,53 @@ namespace nt */ class NT_API CursorManager { + public: + /** @brief Active scan state for a single relation. */ + struct cursor { + /** Handle that authorized this cursor. */ + HandlerManager::handle* handle; + // TODO: Replace with a lazy iterator into the physical storage backend. + // Pre-loading all tuples on Open() is a mock simplification. + std::vector<Tuple> tuples; + size_t position = 0; + }; + + /** + * @brief Opens a cursor on the relation referenced by the handle. + * @param handle Authorized handle to a RELATION object. + * @return A new cursor, or nullptr if the object is not a RELATION. + */ + cursor* Open(HandlerManager::handle* handle); + + /** + * @brief Pulls the next tuple from the cursor. + * + * The returned pointer is valid until the next Next() or Close() call. + * + * @param cursor Active cursor. + * @return Pointer to the next tuple, or nullptr when exhausted. + */ + Tuple* Next(cursor* cursor); + + /** + * @brief Closes the cursor and releases its resources. + * @param cursor Cursor to close. + */ + void Close(cursor* cursor); + + /** + * @brief Inserts one tuple into the mock store for a given relation path. + * + * TODO: Replace with physical storage writes when the backend is wired up. + * + * @param path Logical path of the relation. + * @param tuple Attribute values for the tuple to insert. + */ + void MockInsert(std::vector<std::string> path, std::vector<Attribute> tuple); + + private: + // TODO: Replace with physical storage backend access. + // Keyed by the relation path joined as "seg/seg/...". + std::unordered_map<std::string, std::vector<std::vector<Attribute>>> mock_store_; }; } |
