aboutsummaryrefslogtreecommitdiffstats
path: root/src/CursorManager.cpp
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-05-13 01:59:22 -0300
committerGitHub <noreply@github.com>2026-05-13 01:59:22 -0300
commitaf6073dedffd1a16aff7a283ded50545dc40b179 (patch)
treea4b8fbfb4842f5ac27bf7fa641555de3fac6b7f3 /src/CursorManager.cpp
parentc1b70cfe745d935bded3053fba8c1f9573aa07aa (diff)
downloadRNT-af6073dedffd1a16aff7a283ded50545dc40b179.tar.gz
RNT-af6073dedffd1a16aff7a283ded50545dc40b179.zip
Extern handles for embedded runtime
Diffstat (limited to 'src/CursorManager.cpp')
-rw-r--r--src/CursorManager.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/CursorManager.cpp b/src/CursorManager.cpp
index 91a0183..219ba2e 100644
--- a/src/CursorManager.cpp
+++ b/src/CursorManager.cpp
@@ -1,4 +1,5 @@
#include "CursorManager.h"
+#include "Merkle.h"
#include "ObjectManager.h"
#include "TupleCodec.h"
@@ -8,9 +9,9 @@ namespace nt
: backend_(backend)
{}
- void CursorManager::LoadPage(cursor* c, const std::vector<std::string>& path)
+ void CursorManager::LoadPage(cursor* c)
{
- auto hashes = backend_.TupleHashes(path, c->fetch_offset, PAGE_SIZE);
+ auto hashes = Merkle::Page(backend_, c->merkle_root, c->fetch_offset, PAGE_SIZE);
c->page.clear();
c->page_position = 0;
@@ -26,7 +27,8 @@ namespace nt
c->exhausted = true;
}
- CursorManager::cursor* CursorManager::Open(HandlerManager::handle* handle)
+ CursorManager::cursor* CursorManager::Open(HandlerManager::handle* handle,
+ const std::string& merkle_root)
{
if (handle == nullptr || handle->object == nullptr)
return nullptr;
@@ -47,14 +49,17 @@ namespace nt
return nullptr;
auto* c = new cursor();
- c->handle = handle;
- LoadPage(c, handle->object->head->path);
+ c->handle = handle;
+ c->merkle_root = merkle_root;
- if (c->page.empty())
+ if (merkle_root.empty())
{
- delete c;
- return nullptr;
+ // Empty relation: valid but immediately exhausted.
+ c->exhausted = true;
+ return c;
}
+
+ LoadPage(c);
return c;
}
@@ -80,7 +85,7 @@ namespace nt
return &c->page[c->page_position++];
}
- LoadPage(c, c->handle->object->head->path);
+ LoadPage(c);
if (c->page.empty()) return nullptr;
return &c->page[c->page_position++];
}