Relational NT
A relational database kernel shaped around NT-style object management.
Loading...
Searching...
No Matches
nt::SqliteBackend Class Reference
Inheritance diagram for nt::SqliteBackend:
nt::IStorageBackend

Public Member Functions

 SqliteBackend (const std::string &path=":memory:")
 Opens (or creates) a SQLite database at path.
std::string Put (std::vector< uint8_t > value) override
 Stores a serialized value and returns its SHA256 hex hash.
std::optional< std::vector< uint8_t > > Get (const std::string &hash) override
 Retrieves bytes by their SHA256 hex hash.

Constructor & Destructor Documentation

◆ SqliteBackend()

nt::SqliteBackend::SqliteBackend ( const std::string & path = ":memory:")
explicit

Opens (or creates) a SQLite database at path.

Parameters
pathFile path, or ":memory:" for an in-process database.
Exceptions
std::runtime_errorif the database cannot be opened.

Member Function Documentation

◆ Get()

std::optional< std::vector< uint8_t > > nt::SqliteBackend::Get ( const std::string & hash)
overridevirtual

Retrieves bytes by their SHA256 hex hash.

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

Implements nt::IStorageBackend.

◆ Put()

std::string nt::SqliteBackend::Put ( std::vector< uint8_t > value)
overridevirtual

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.

Implements nt::IStorageBackend.


The documentation for this class was generated from the following files: