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:

1 access
2 access/config
3 access/config/lens = Access.lns
4 access/infos
5 access/infos/format = access
6 aliases
7 aliases/config
8 aliases/config/lens = Aliases.lns
9 aliases/config/path = /etc/aliases
10 aliases/infos
11 aliases/infos/format = aliases

genconf for python yields:

1 configparser/config
2 configparser/config/script = python_configparser.py

the user specifies:

1 system/elektra/plugins/variants/access
2 system/elektra/plugins/variants/aliases/infos/status = 10000
3 system/elektra/plugins/variants/configparser
4 system/elektra/plugins/variants/configparser/config
5 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.