Plugins can be mounted into the KDB and can access or manipulate the KeySet on every access.
Multiple plugins can be mounted into the key data base. On every access to the key data base they are executed and thus can change the functionality.
Elektra already 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:
Overview Plugins
For background information see elektra-plugins-framework(7).
C-Interface
All plugins implement the same interface:
kdbOpen()
calls elektraPluginOpen()
of every plugin to let them do their initialisation.
kdbGet()
requests elektraPluginGet()
of every plugin in the queried backends to return a key set.
kdbSet()
usually calls elektraPluginSet()
of every plugin in the queried backends to store the configuration.
kdbSet()
also calls elektraPluginError()
for every plugin when an error happens. Because of elektraPluginError()
, plugins are guaranteed to have their chance for necessary cleanups.
kdbClose()
makes sure that plugins can finally free their own resources in elektraPluginClose()
.
kdbPluginCheckConfig()
can be called manually to ensure a plugin is configured properly.
KDB-Interface
See also
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.
Plugins
Resolver
Before configuration is actually written, the file name needs to be determined (will be automatically added by kdb mount):
- resolver uses 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 file with harddisc
Storage
Are responsible for reading writing the configuration to configuration files.
Read and write everything a KeySet might contain:
- dump makes a dump of a KeySet in an Elektra-specific format
Read (and write) standard config files:
- augeas parses and generates many different configuration files using the augeas library
- hosts read/write hosts files
- line reads any file line by line
- ini parses INI files based on inih.
- yajl uses JSON.
Using semi-structured data for config files, mainly suitable for spec-namespace (put a focus on having nice syntax for metadata):
- ni parses INI files based on (including metadata) ni.
- tcl-like config files (including metadata).
Only suited for import/export:
- xmltool uses XML (in Elektra's XML schema).
- simpleini line-based key-value pairs with configurable format (without sections)
Plugins that just show some functionality, (currently) not intended for productive use:
System Information
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
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:
- keytometa transforms keys to metadata
- rename renames keys according to different rules
- boolean canonicalizes boolean keys
Doing other stuff:
- crypto encrypts / decrypts confidential values
- fcrypt encrypts / decrypts entire backend files
- iconv make 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
Notification and Logging
Log/Send out all changes to configuration to:
Debug
Trace everything that happens within KDB:
Checker
Copies metadata to keys:
- glob using globbing techniques
- struct using a defined structure (may also reject configuration not conforming to that structure)
- spec copies metadata from spec namespace Plugins that check if values are valid based on metadata (typically copied by another plugin just before):
Value Validation
- validation by using regex
- network by using network APIs
- path by checking files on filesystem
- type using runtime type checking (CORBA types/)
- enum compares the keyvalue against a list of valid values
- mathcheck by mathematical expressions using keysvalues as operands
- conditionals by using if-then-else like statements
- required rejects non-required keys
Other Validation
Interpreter
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 runtime.
- jni java plugins started by jni, works with jna plugins
- python Python 3 plugins
- python2 Python 2 plugins (deprecated)
- lua Lua plugins
- shell executes shell commandos
Others
- 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
- list loads other plugins
- iterate iterate over all keys and run exported functions on tagged keys
- semlock a semaphore based global locking logic
- profile links profile keys
- simplespeclang simple configuration specification language