A face's persistence identity. More...
#include <settings.h>
Data Fields | |
| uint32_t | key |
| Storage key for this face's blob. | |
| uint8_t | version |
| This face's current schema version. | |
| uint16_t | min_versioned_size |
| Smallest versioned blob accepted, the frozen v1 size. | |
| void * | blob |
| The face's settings struct, version byte first. | |
| uint16_t | blob_size |
| Size of that struct, best set with SETTINGS_BLOB_SIZE. | |
| const SettingField * | fields |
| The face's field table. | |
| uint8_t | field_count |
| How many entries are in fields. | |
| bool(*) | migrate (int stored_size) |
| Lifts an old blob from before versioning, true if handled. NULL when none. | |
| const struct SettingsSchema * | companion |
| Next schema in the chain, or NULL. | |
A face's persistence identity.
Its storage key, current schema version, frozen v1 blob size, the face struct to load into (its first byte must be the uint8_t version), that struct's size, the field table that drives defaults/sanitize/serialization, and an optional migration hook to rescue pre-versioned data.
A face can persist more than one struct by chaining schemas through companion: each schema points to the next and the last one is NULL. settings_init walks the chain so load, save, serialize, and inbox decode all cover every schema. Each link owns its own key, version, and blob, so a domain (e.g. weather or a colour table) can sit in its own key instead of bloating the main one. The typed reads (settings_u8/str) index the whole chain and remember each field's owning schema, so a shared field (id < SETTING_COUNT) can live in any link.