diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-13 01:59:22 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-13 01:59:22 -0300 |
| commit | af6073dedffd1a16aff7a283ded50545dc40b179 (patch) | |
| tree | a4b8fbfb4842f5ac27bf7fa641555de3fac6b7f3 /include/InMemoryBackend.h | |
| parent | c1b70cfe745d935bded3053fba8c1f9573aa07aa (diff) | |
| download | RNT-af6073dedffd1a16aff7a283ded50545dc40b179.tar.gz RNT-af6073dedffd1a16aff7a283ded50545dc40b179.zip | |
Extern handles for embedded runtime
Diffstat (limited to '')
| -rw-r--r-- | include/InMemoryBackend.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/include/InMemoryBackend.h b/include/InMemoryBackend.h index 8f7f50a..55472a8 100644 --- a/include/InMemoryBackend.h +++ b/include/InMemoryBackend.h @@ -11,33 +11,23 @@ /** * @file InMemoryBackend.h - * @brief In-process KV storage backend backed by unordered_maps. + * @brief In-process KV storage backend backed by an unordered_map. + * + * Intended for unit tests where SQLite is not appropriate. Data does not + * survive process exit and is not thread-safe. + * + * Relation membership is tracked by the Merkle class, not this backend. */ namespace nt { - /** - * @interface InMemoryBackend - * @brief IStorageBackend implementation that keeps all data in process memory. - * - * Intended for unit tests where SQLite is not appropriate. Data does not - * survive process exit and is not thread-safe. - */ class NT_API InMemoryBackend : public IStorageBackend { public: std::string Put(std::vector<uint8_t> value) override; std::optional<std::vector<uint8_t>> Get(const std::string& hash) override; - void LinkTuple(const std::vector<std::string>& relation_path, - const std::string& tuple_hash) override; - std::vector<std::string> TupleHashes(const std::vector<std::string>& relation_path, - std::size_t offset, - std::size_t limit) override; private: std::unordered_map<std::string, std::vector<uint8_t>> kv_; - std::unordered_map<std::string, std::vector<std::string>> index_; - - static std::string PathKey(const std::vector<std::string>& path); }; } |
