Skip to main content

Module storage

Module storage 

Source
Expand description

Persistent storage for the information bases.

The NIB/AIB live in a RAM mirror; every setter marks its field dirty and signals a change. The application only chooses where the state lives: RAM-only via the plain init() functions, or NOR flash via init_with_flash plus a spawned task running FlashStorage::run that persists changes as they happen.

Frame counters are persisted with headroom so a reboot can never reuse an outgoing counter value: outgoing counters are stored rounded up two HEADROOM boundaries ahead, incoming counters rounded down to a WINDOW boundary. After a reboot up to WINDOW already-seen incoming counter values may be accepted again — the cost of not writing flash on every received frame.

The per-IB restore/flush logic lives with the respective information base (nwk::nib::storage, aps::aib::storage); this module only provides the flash map plumbing.

Structs§

FlashStorage
Persistence of the information bases over a NOR flash region.
NoStorage
RAM-only operation: state is lost on reset.

Traits§

StorageDriver
Sink dirty information-base state is flushed into.

Functions§

init_with_flash
Initializes the NIB and AIB backed by the given flash region.