From af6073dedffd1a16aff7a283ded50545dc40b179 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Wed, 13 May 2026 01:59:22 -0300 Subject: Extern handles for embedded runtime --- src/InMemoryBackend.cpp | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'src/InMemoryBackend.cpp') diff --git a/src/InMemoryBackend.cpp b/src/InMemoryBackend.cpp index 4d637fe..4649da0 100644 --- a/src/InMemoryBackend.cpp +++ b/src/InMemoryBackend.cpp @@ -1,17 +1,9 @@ #include "InMemoryBackend.h" #include -#include namespace nt { - std::string InMemoryBackend::PathKey(const std::vector& path) - { - return std::accumulate( - std::next(path.begin()), path.end(), path.front(), - [](std::string a, const std::string& b) { return std::move(a) + "/" + b; }); - } - std::string InMemoryBackend::Put(std::vector value) { const std::string hash = picosha2::hash256_hex_string(value.begin(), value.end()); @@ -22,34 +14,7 @@ namespace nt std::optional> InMemoryBackend::Get(const std::string& hash) { auto it = kv_.find(hash); - if (it == kv_.end()) - return std::nullopt; + if (it == kv_.end()) return std::nullopt; return it->second; } - - void InMemoryBackend::LinkTuple(const std::vector& relation_path, - const std::string& tuple_hash) - { - auto& hashes = index_[PathKey(relation_path)]; - for (const auto& h : hashes) - if (h == tuple_hash) return; - hashes.push_back(tuple_hash); - } - - std::vector InMemoryBackend::TupleHashes( - const std::vector& relation_path, - std::size_t offset, - std::size_t limit) - { - auto it = index_.find(PathKey(relation_path)); - if (it == index_.end() || offset >= it->second.size()) - return {}; - - const auto& all = it->second; - auto begin = all.begin() + static_cast(offset); - auto end = (offset + limit <= all.size()) - ? begin + static_cast(limit) - : all.end(); - return { begin, end }; - } } -- cgit v1.2.3