$darkmode
Elektra 0.11.0
|
Validation plugins operate as independent blackboxes. For every backend each mounted validation plugin iterates over the whole keyset, checks every key for its trigger metakey, and validates the key.
Currently all needed validation plugins need to be specified at mount-time; if additional validation is required, the backend has to be remounted with the required plugins and plugin configuration.
If validation of a key fails, each plugin decides on its own how to handle the issue and proceed in ways that might be different from what is expected or desired.
While plugins should always fail and return an error if validation fails on kdbSet, there are several different requirements for what should happen on kdbGet and handle problems e.g.
only issue warnings
we want to read the whole configuration, but issue warnings if keys fail to validate instead
problems are handled external by an application, user, ...
remove invalid keys
we want to read the whole configuration, but drop invalid keys
invalid keys might be replaced by default values, requested from the user, ...
fail with error
we only want to read valid configurations, and fail with an error if the configuration is invalid
Don't do anything for 1.0.
Later, maybe introduce a wrapper plugin to iterate over the keyset and delegate the validation of each key to the corresponding validation plugin.
Validation plugins have to export their validation routine
static int validateKey(const Key * key, const Key * errorKey)
Returning 1 if validation succeeded, 0 on failure