pw_kvs#
Lightweight, persistent key-value store
Stable C++17 Code Size Impact: ~12 kB
pw_kvs is a flash-backed, persistent key-value storage system with
integrated wear leveling and redundancy, targeting NOR flash devices where a
full filesystem is not needed. Key properties include:
Wear leveling: Spreads writes across flash sectors to extend the life of the storage medium.
Corruption resilience: Optionally stores multiple copies of each key-value entry, spread over flash sectors.
pw_kvsdetects corrupted entries on read, and can fall back to a previous version of the data.Flexibility: Supports configuration changes after a product has shipped. For example, a firmware update can increase the total size of the KVS or increase or decrease the level of redundancy.
Simple on-disk format: Log-structured database where entries are appended sequentially. This design has a minimal set of invariants, which simplifies implementation and improves robustness against unexpected power loss.