|
| | 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.
|
◆ SqliteBackend()
| nt::SqliteBackend::SqliteBackend |
( |
const std::string & | path = ":memory:" | ) |
|
|
explicit |
Opens (or creates) a SQLite database at path.
- Parameters
-
| path | File path, or ":memory:" for an in-process database. |
- Exceptions
-
| std::runtime_error | if the database cannot be opened. |
◆ 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: