Loading...
Searching...
No Matches
SettingsSchema Struct Reference

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 first_size
 The struct's size in its first release, the smallest blob accepted. Set with SETTINGS_BLOB.
void * blob
 The face's settings struct, version byte first. Set with SETTINGS_BLOB.
uint16_t blob_size
 Size of that struct. Set with SETTINGS_BLOB.
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.

Detailed Description

A face's persistence identity.

Its storage key, current schema version, the face struct to load into (its first byte must be the uint8_t version), that struct's size and the size it first shipped at, the field table that drives defaults/sanitize/serialization, and an optional migration hook to rescue pre-versioned data. SETTINGS_BLOB fills in the struct and both sizes.

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. A face built with a plugin define also gets the framework's own schema, on SETTINGS_PLUGIN_SOURCE_KEY. It is never linked onto the face's chain. The walk in settings_chain.h visits it after the face's last schema.


The documentation for this struct was generated from the following file: