Relational NT
A relational database kernel shaped around NT-style object management.
Loading...
Searching...
No Matches
nt::IStorageBackend Interface Referenceabstract

Contract between CursorManager / Merkle and a physical storage engine. More...

#include <IStorageBackend.h>

Inheritance diagram for nt::IStorageBackend:
nt::InMemoryBackend nt::SqliteBackend

Public Member Functions

virtual std::string Put (std::vector< uint8_t > value)=0
 Stores a serialized value and returns its SHA256 hex hash.
virtual std::optional< std::vector< uint8_t > > Get (const std::string &hash)=0
 Retrieves bytes by their SHA256 hex hash.

Detailed Description

Contract between CursorManager / Merkle and a physical storage engine.

Two primitives are sufficient:

  • Put: store bytes, get back the content-address (SHA256 hex).
  • Get: retrieve bytes by content-address.

Both are idempotent. The Merkle class stores node blobs via Put/Get and maintains insertion-order-independent relation membership on top of these two primitives.

Member Function Documentation

◆ Get()

virtual std::optional< std::vector< uint8_t > > nt::IStorageBackend::Get ( const std::string & hash)
pure virtual

Retrieves bytes by their SHA256 hex hash.

Returns
The stored bytes, or std::nullopt when the hash is unknown.

Implemented in nt::InMemoryBackend, and nt::SqliteBackend.

◆ Put()

virtual std::string nt::IStorageBackend::Put ( std::vector< uint8_t > value)
pure virtual

Stores a serialized value and returns its SHA256 hex hash.

Idempotent: storing the same bytes twice does not create a duplicate. The returned hash is the only valid key for subsequent Get calls.

Implemented in nt::InMemoryBackend, and nt::SqliteBackend.


The documentation for this interface was generated from the following file: