|
| | EspNvs (const char *namespace_name) noexcept |
| | Constructor with namespace specification.
|
| |
| | ~EspNvs () noexcept override |
| | Destructor - ensures proper cleanup.
|
| |
| hf_nvs_err_t | Initialize () noexcept override |
| | Initialize the NVS system and open the namespace.
|
| |
| hf_nvs_err_t | Deinitialize () noexcept override |
| | Deinitialize the NVS system and close the namespace.
|
| |
| hf_nvs_err_t | SetU32 (const char *key, hf_u32_t value) noexcept override |
| | Store a 32-bit unsigned integer value.
|
| |
| hf_nvs_err_t | GetU32 (const char *key, hf_u32_t &value) noexcept override |
| | Retrieve a 32-bit unsigned integer value.
|
| |
| hf_nvs_err_t | SetString (const char *key, const char *value) noexcept override |
| | Store a string value.
|
| |
| hf_nvs_err_t | GetString (const char *key, char *buffer, size_t buffer_size, size_t *actual_size=nullptr) noexcept override |
| | Retrieve a string value.
|
| |
| hf_nvs_err_t | SetBlob (const char *key, const void *data, size_t data_size) noexcept override |
| | Store binary data (blob).
|
| |
| hf_nvs_err_t | GetBlob (const char *key, void *buffer, size_t buffer_size, size_t *actual_size=nullptr) noexcept override |
| | Retrieve binary data (blob).
|
| |
| hf_nvs_err_t | EraseKey (const char *key) noexcept override |
| | Remove a key from storage.
|
| |
| hf_nvs_err_t | Commit () noexcept override |
| | Commit any pending writes to non-volatile storage.
|
| |
| bool | KeyExists (const char *key) noexcept override |
| | Check if a key exists in storage.
|
| |
| hf_nvs_err_t | GetSize (const char *key, size_t &size) noexcept override |
| | Get the size of a stored value.
|
| |
| const char * | GetDescription () const noexcept override |
| | Get description of this NVS implementation.
|
| |
| size_t | GetMaxKeyLength () const noexcept override |
| | Get maximum key length supported.
|
| |
| size_t | GetMaxValueSize () const noexcept override |
| | Get maximum value size supported.
|
| |
| hf_nvs_err_t | GetStatistics (hf_nvs_statistics_t &statistics) const noexcept override |
| | Get NVS operation statistics.
|
| |
| hf_nvs_err_t | GetDiagnostics (hf_nvs_diagnostics_t &diagnostics) const noexcept override |
| | Get NVS diagnostic information.
|
| |
| virtual | ~BaseNvs () noexcept=default |
| | Virtual destructor to ensure proper cleanup.
|
| |
| | BaseNvs (const BaseNvs &)=delete |
| |
| BaseNvs & | operator= (const BaseNvs &)=delete |
| |
| bool | EnsureInitialized () |
| | Ensures that the NVS storage is initialized (lazy initialization).
|
| |
| bool | EnsureDeinitialized () |
| | Ensures that the NVS storage is deinitialized.
|
| |
| bool | IsInitialized () const noexcept |
| | Check if storage is initialized.
|
| |
| const char * | GetNamespace () const noexcept |
| | Get the namespace name.
|
| |
| virtual hf_nvs_err_t | ResetStatistics () noexcept |
| | Reset NVS operation statistics.
|
| |
| virtual hf_nvs_err_t | ResetDiagnostics () noexcept |
| | Reset NVS diagnostic information.
|
| |
Production-ready MCU-integrated non-volatile storage implementation.
This class provides comprehensive non-volatile storage using the microcontroller's built-in storage mechanisms with enterprise-grade features. On ESP32-C6, it leverages the modern ESP-IDF v5.5+ NVS library with advanced security, performance optimizations, and comprehensive error handling. The implementation provides the unified BaseNvs API while exposing platform-specific advanced features.
Core Features:
- Key-value storage using MCU's integrated NVS with namespace isolation
- Multiple data type support (uint32_t, string, blob) with type safety
- Atomic operations with consistency guarantees and durability
- Comprehensive error handling with detailed error reporting
- Performance monitoring and statistics tracking
- Thread-safe operations with optional mutex protection
ESP32-C6 Advanced Features:
- HMAC-based encryption for secure storage without flash encryption
- XTS encryption with eFuse-based key management
- Handle-based modern ESP-IDF v5.5+ API with improved performance
- Comprehensive error mapping for all ESP32-C6 NVS error conditions
- Support for encrypted and non-encrypted partitions
- Advanced partition management and configuration options
Performance Characteristics:
- Optimized for high-frequency read/write operations
- Intelligent commit strategies balancing durability vs. performance
- Efficient handle management with validation caching
- Statistics tracking with minimal performance overhead
- Key validation with comprehensive constraint checking
Security Features:
- Hardware-backed encryption using ESP32-C6 HMAC peripheral
- Tamper-resistant key storage in eFuse blocks
- Data integrity validation and corruption detection
- Secure key generation and management
- Protection against unauthorized access and data tampering
- Note
- This implementation requires sufficient flash storage on the MCU.
-
ESP32-C6 encryption features require proper eFuse configuration.
-
Thread safety is optional and controlled by HF_THREAD_SAFE define.
-
All operations are atomic and provide consistency guarantees.
- Warning
- Encryption keys stored in eFuse are permanent and irreversible.
-
Ensure proper backup and key management procedures.
- See also
- BaseNvs for the abstract interface definition
-
McuTypes.h for platform-specific type definitions
-
McuSelect.h for platform selection and configuration