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: ``` access access/config access/config/lens = Access.lns access/infos access/infos/format = access aliases aliases/config aliases/config/lens = Aliases.lns aliases/config/path = /etc/aliases aliases/infos aliases/infos/format = aliases ```

genconf for python yields: ``` configparser/config 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/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)

Argument

Implications

Related decisions

Notes

Discussions took place here.