14#include <unordered_map>
22 explicit HostNvs(
const char* name);
32 size_t* actual_size) noexcept override;
33 hf_nvs_err_t SetBlob(const
char* key, const
void* data,
size_t data_size) noexcept override;
35 size_t* actual_size) noexcept override;
38 bool KeyExists(const
char* key) noexcept override;
46 std::unordered_map<std::
string, std::vector<uint8_t>>
blobs_;
48 std::unordered_map<std::
string, std::
string>
strings_;
Abstract base class for Non-Volatile Storage implementations in the HardFOC system.
hf_nvs_err_t
Definition BaseNvs.h:76
uint32_t hf_u32_t
Platform-agnostic 32-bit unsigned integer type.
Definition HardwareTypes.h:52
Abstract base class for non-volatile storage operations.
Definition BaseNvs.h:147
Hash-map NVS namespace for host builds and deterministic tests.
Definition HostNvs.h:20
hf_nvs_err_t GetU32(const char *key, hf_u32_t &value) noexcept override
Retrieve a 32-bit unsigned integer value.
Definition HostNvs.cpp:40
hf_nvs_err_t GetBlob(const char *key, void *buffer, size_t buffer_size, size_t *actual_size) noexcept override
Retrieve binary data (blob).
Definition HostNvs.cpp:23
std::unordered_map< std::string, std::string > strings_
Definition HostNvs.h:48
size_t GetMaxValueSize() const noexcept override
Get maximum value size supported.
Definition HostNvs.cpp:93
hf_nvs_err_t Deinitialize() noexcept override
Deinitialize the storage system and close the namespace.
Definition HostNvs.cpp:13
std::unordered_map< std::string, hf_u32_t > u32s_
Definition HostNvs.h:47
size_t GetMaxKeyLength() const noexcept override
Get maximum key length supported.
Definition HostNvs.cpp:92
bool KeyExists(const char *key) noexcept override
Check if a key exists in storage.
Definition HostNvs.cpp:71
std::unordered_map< std::string, std::vector< uint8_t > > blobs_
Definition HostNvs.h:46
hf_nvs_err_t SetBlob(const char *key, const void *data, size_t data_size) noexcept override
Store binary data (blob).
Definition HostNvs.cpp:16
hf_nvs_err_t Commit() noexcept override
Commit any pending writes to non-volatile storage.
Definition HostNvs.cpp:14
const char * GetDescription() const noexcept override
Get description of this storage implementation.
Definition HostNvs.cpp:91
hf_nvs_err_t SetString(const char *key, const char *value) noexcept override
Store a string value.
Definition HostNvs.cpp:47
hf_nvs_err_t GetString(const char *key, char *buffer, size_t buffer_size, size_t *actual_size) noexcept override
Retrieve a string value.
Definition HostNvs.cpp:53
hf_nvs_err_t EraseKey(const char *key) noexcept override
Remove a key from storage.
Definition HostNvs.cpp:64
hf_nvs_err_t Initialize() noexcept override
Initialize the storage system and open the namespace.
Definition HostNvs.cpp:12
hf_nvs_err_t SetU32(const char *key, hf_u32_t value) noexcept override
Store a 32-bit unsigned integer value.
Definition HostNvs.cpp:34
~HostNvs() override=default
hf_nvs_err_t GetSize(const char *key, size_t &size) noexcept override
Get the size of a stored value.
Definition HostNvs.cpp:75
const char * name_
Definition HostNvs.h:45