Elektra  0.8.19
Plugin Variants

Issue

Some plugins are generic in the sense that they cannot fully define their contract statically. (Note: if they can decide it statically, you should prefer compilation variants.) Instead their contract is based on their configuration. We will call every combination of plugins+configuration where we get a different contract plugin variant.

The current issue is that there is no way to enumerate possible plugin variants as needed to list all functionality of Elektra.

Constraints

Assumptions

Considered Alternatives

A specification of the plugin's configuration and a tool that can enumerate all possible essential configurations. Issues here are:

Decision

  1. Provide a function int genconf (KeySet * ks, Key * errorKey) where ks is filled with a list of all variants with the essential configuration (subkeys config) and the changed parts of the contract (subkeys infos).
  2. Keys defined in system/elektra/plugins/variants have the same content, but take precedence. If a variant with the same name is defined, only config or infos from genconf are considered if they are not mentioned in system/elektra/plugins/variants. If the keys config or infos are present, it will be overwritten (deleted), if only subkeys thereof are present, it will be enhanced.
  3. Empty config and infos mean:
    • config: The "default variant" (without any parameter) should be also available (has useful functionality)
    • infos: It is not possible to determine the changes of the contract, the user need to instantiate the plugin and enquiry the contract.

Example

genconf for augeas yields: ``` system/access system/access/config system/access/config/lens = Access.lns system/access/infos system/access/infos/provides = storage/access system/aliases system/aliases/config system/aliases/config/lens = Aliases.lns system/aliases/infos system/aliases/infos/provides = storage/aliases ```

genconf for python might yield: ``` user/configparser/config user/configparser/config/script = python_configparser.py ```

The user specifies: ``` system/elektra/plugins/variants/access system/elektra/plugins/variants/aliases/infos/status = 10000 system/elektra/plugins/variants/configparser system/elektra/plugins/variants/configparser/plugin = python system/elektra/plugins/variants/configparser/config system/elektra/plugins/variants/configparser/config/script = mybetter_configparser.py ```

Then the plugin variant:

  1. access is not available (system/elektra/plugins/variants/access overrides genconf)
  2. aliases as defined from genconf, but with changes in contract (infos/status)
  3. configparser is completely redefined (result from genconf will not be considered)

To have a space-separated simpleini one would use: ``` system/elektra/plugins/variants/simpleini(space) system/elektra/plugins/variants/simpleini(space)/plugin = simpleini system/elektra/plugins/variants/simpleini(space)/config system/elektra/plugins/variants/simpleini(space)/config/format = "% %" ```

Argument

Implications

Related decisions

Notes

Discussions took place here.