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. Corrupted entries are detected on read, and the KVS can fall back to a previous version of the data.

  • Flexibility: Supports configuration changes after a product has shipped. or example, the total size of the KVS and the level of redundancy can be increased in a firmware update.

  • 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.

Get Started & Guides

Integrate and use pw_kvs in your project.

API Reference

Detailed description of the pw_kvs classes and methods.

On-Disk Format & Design

Understand how pw_kvs stores data on flash.

Code Size Analysis

Understand pw_kvs’s code footprint.