Multiple plugins can be mounted into the key database (KDB). On every access to the key data base they are executed and thus can change the functionality and behavior.
Elektra has a wide range of different plugins. The plugin folders should contain a README.md with further information. (Or follow links below.) The plugins are:
All plugins implement the same interface:
kdbOpen()
callselektraPluginOpen()
of every plugin to let them do their initialisation.kdbGet()
requestselektraPluginGet()
of every plugin in the queried backends to return a key set.kdbSet()
usually callselektraPluginSet()
of every plugin in the queried backends to store the configuration.kdbSet()
also callselektraPluginError()
for every plugin when an error happens. Because ofelektraPluginError()
, plugins are guaranteed to have their chance for necessary cleanups.kdbClose()
makes sure that plugins can finally free their own resources inelektraPluginClose()
.kdbCheckConfig()
can be called manually to ensure a plugin is configured properly.kdbGenConfig()
can be called to produce all valid configurations of a plugin.
- To list all plugins use kdb-list(1).
- To check a plugin use kdb-check(1).
- For information on a plugin use kdb-info(1).
- For mount plugin(s) use kdb-mount(1).
For an easy introduction, see this tutorial how to write a storage plugin. For more background information of the plugins framework, continue here. Otherwise, you can visit the the API documentation.
Before configuration is actually written, the file name needs to be determined (resolvers will be automatically added by kdb mount):
-
resolver uses advanced POSIX APIs to handle conflicts gracefully
-
wresolver minimalistic resolver for non-POSIX systems
-
noresolver does not resolve, but can act as one
-
gitresolver checks out and commits files to a local git repository and afterwards the configuration file must be synced with harddisc (recommended to add at every kdb mount):
-
curlget fetches configuration file from a remote host
-
blockresolver resolves tagged blocks inside config files
-
sync uses POSIX APIs to sync configuration files with the hard disk
Are responsible for reading writing the configuration to configuration files.
Read and write everything a KeySet might contain:
- dini uses by default the ini plugin but has legacy support for dump
- ini supports a range of INI file formats.
- dump makes a dump of a KeySet in an Elektra-specific format
- quickdump uses binary portable format based on dump, but more efficient
Read (and write) standard config files:
- augeas reads/writes many different configuration files using the augeas library
- hosts reads/writes hosts files
- line reads/writes any file line by line
- yajl reads/writes JSON.
Using semi-structured data for config files, mainly suitable for spec-namespace (put a focus on having nice syntax for metadata):
Only suited for import/export:
- xerces uses XML (without a specific schema).
- xmltool uses XML (in Elektra's XML schema).
- simpleini line-based key-value pairs with configurable format (without sections)
- mini dependency free, line based key-value storage plugin.
- yamlsmith exports key sets in the YAML format
Plugins that just show some functionality, (currently) not intended for productive use:
- typechecker type checks a configuration specification
- regexdispatcher generates regex representations of specification keywords
- fstab for fstab files.
- regexstore
- csvstorage for csv files
- passwd for passwd files
- dpkg reads /var/lib/dpkg/{available,status}
- mozprefs for Mozilla preference files
- c writes Elektra C-structures (
ksNew(.. keyNew(...
) - file reads and writes a file from/to a single key
- camel reads and writes a very limited subset of YAML
- yamlcpp reads and writes data in the YAML format using yaml-cpp
- yanlr reads data using a parser generated by ANTLR
- yambi reads data using a parser generated by Bison
- yawn reads YAML data using YAEP
- yaypeg reads YAML data using a PEG parser combinators based on PEGTL
- mmapstorage uses binary, not portable memory mapped file for a high performance storage
- specload calls an external application to request its specification, depends on quickdump
Information compiled in Elektra:
- version is a built-in plugin directly within the core so that it cannot give wrong version information
- constants various constants, including version information
- desktop contains information which desktop is currently running
Providing information found on the system not available in persistent files:
- uname information from the uname syscall.
Filter plugins process keys and their values in both directions. In one direction they undo what they do in the other direction. Most filter plugins available now encode and decode values. Storage plugins that use characters to separate key names, values or metadata will not work without them.
- cachefilter stores filtered keys internally so that they do not get accidentally lost and can be written to the storage again without the user having to remember including them in the writeout
Encoding
Rewrite unwanted characters with different techniques:
- ccode using the technique from arrays in the programming language C
- hexcode using hex codes
- base64 using the Base64 encoding scheme (RFC4648)
Transformations:
- directoryvalue converts directory values to leaf values
- keytometa transforms keys to metadata
- rename renames keys according to different rules
- boolean canonicalizes boolean keys
- hexnumber converts between hexadecimal and decimal
Doing other stuff:
- crypto encrypts / decrypts confidential values
- gpgme encrypts / decrypts confidential values (with GPGME)
- fcrypt encrypts / decrypts entire backend files
- iconv makes sure the configuration will have correct character encoding
- hidden hides keys whose names start with a
.
. - null takes care of null values and other binary specialities
Log/Send out all changes to configuration to:
- dbus sends notifications for every change via dbus
notification
- dbusrecv receives notifications via dbus
notification
- zeromqsend sends notifications for every change via ZeroMQ sockets
notification
- zeromqrecv receives notifications via ZeroMQ sockets
notification
- syslog logs key database changes to syslog
- journald logs key database changes to journald
- logchange prints the change of every key on the console
Notification of key changes:
- internalnotification get updates automatically when registered keys were changed
Trace everything that happens within KDB:
- timeofday prints timestamps
- tracer traces all calls
- counter count and print how often a plugin is used
Copies metadata to keys:
- spec copies metadata from spec namespace (the standard way)
- glob using globbing techniques (needed by some plugins)
- struct using a defined structure (may also reject configuration not conforming to that structure)
Plugins that check if values are valid based on metadata (typically
copied by the spec
plugin just before):
Value Validation
- validation by using regex
- network by using network APIs
- ipaddr checks IP addresses using regular expressions
- path by checking files on file system
- cpptype obsolete plugin for run-time type checking (CORBA types/), use
type
instead - enum compares the keyvalue against a list of valid values
- type type checking (CORBA types) and enum functionality
- mathcheck by mathematical expressions using key values as operands
- conditionals by using if-then-else like statements
- required rejects non-required keys
- date validates date and time data
- range checks if a value is within a given range
- reference checks if a value is a valid reference to another key
- rgbcolor validates and normalizes hexcolors
Other Validation
- filecheck does sanity checks on a file
- lineendings tests file for consistent line endings
These plugins start an interpreter and allow you to execute a script in an interpreted language whenever Elektra’s key database gets accessed. Note that they depend on the presence of the respective binding during run-time.
- jni java plugins started by jni, works with jna plugins
- python Python 3 plugins
- python2 Python 2 plugins (deprecated)
- ruby Ruby plugins
- lua Lua plugins
- shell executes shell commandos
- haskell used for linking haskell plugins and is a small example for such plugins itself
- doc contains the documentation of the plugin interface
- error yields errors as described in metadata (handy for test purposes)
- template to be copied for new plugins
- cpptemplate a template for C++ based plugins
- list loads other plugins
- iterate iterate over all keys and run exported functions on tagged keys
- process proxy plugin that executes other plugins in a separate process
- profile links profile keys
- simplespeclang simple configuration specification language
- gopts global plugin to automatically call
elektraGetOpts
- cache caches keysets from previous
kdbGet()
calls