3.9 Persistent configuration service
[Libraries module]

The Persistent configuration service module is described through the following subsections:

The persist library offers a basic and simple configuration storage service in flash memory.

Operations involve:

  • Read a value,

  • Write a value,

  • Delete a value,

  • Pack storage backend (reclaim unused space),

  • Erase storage.

persist devices can hold up to 2^16 values, distinguished through their UID (unique identifier).

Stored values must have a static declaration (). Values may be of one of two types:

  • Blobs, binary objects read/write verbatim;

  • Counters, 64 bit values that can either be added to or erased.

In order to be able to share a declaration among various similar values, requests may set an uid_offset that gets added to the descriptor's UID when looking up value in storage backend. As a consequence of that, if offsets are used, UID must be choosen carefully to avoid collisions.

Storage backend takes all possible measures to ensure value validity and durability. In particular, special care is taken to ensure no data is lost in case of power outage during write phases.

Size of blobs is known in advance and is part of their declaration. They cannot extend beyond their preallocated size.

Size of counters must be at least 8 bytes, They make no interest under 9 bytes. Any byte beyond 8-th serves as an optimization on increment operations: increments are done in-place using spare bits as an unary value that adds to the counter. This makes sense on flash-based storage backends where a page-erase operation is required before writing new data. Optimal size to allocate to a counter is a usage-dependant tradeof.

See also struct persist_descriptor_s.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:05 2022 using MkDoc