In case you do not yet know about it, here is an abstract about Elektra:
Elektra serves as a universal and secure framework to access configuration parameters in a global, hierarchical key database. Elektra provides a mature, consistent and easily comprehensible API. Its modularity effectively avoids code duplication across applications and tools regarding configuration tasks. Elektra abstracts from cross-platform-related issues and allows applications to be aware of other applications' configurations, leveraging easy application integration.
This is one of the largest release up to now. It includes many user-visible improvements. Some highlights:
libelektra
into smaller parts.
Now users can link against the parts of the library they need.ini
, rename
and crypto
plugins.kdb
now supports bookmarks and profiles.kdb editor
allows you to edit KDB configuration in
your favorite text editor.The same text as follows is also available here as html and here on GitHub
Sometimes you simply want some functionality for the whole key database. For example, you want to enable logging or notification of configuration changes. In previous versions, you had to change every mountpoint individually. Even more problematic, every mountpoint created its individual logs and notifications, without any way for someone to know if an application has issued its last log/notification.
These problems are now solved by global plugins. The same plugins are reused for this purpose. Also the mounting works nearly in the same way, you only have to omit the configuration file and the mountpoint:
kdb global-mount syslog journald dbus
Voilà, from now on every configuration change gets logged to syslog and journald. Additionally, every application gets notified via dbus.
If you want it more verbose for debugging, you can easily do so by:
kdb global-mount logchange counter
Which gives you detailed information to standard output which keys
were changed/edited/deleted. Additionally, Elektra counts how often
the counter
plugin is invoked.
The underlying work for the global plugins, i.e. hooks in the core
libraries and the list
plugin that allows us to use many plugins
without bloating the core was done by Thomas Waser.
It was already possible in earlier versions of Elektra to specify the configuration of your program. Until now, this specification could be mainly used to to generate code as described here. This release adds two more interesting options:
The most important global plugin that is now newly introduced with this
release (thanks to Thomas Waser) is the spec
plugin. By default it
will be added for every global-mount. So for a new installation make
sure you executed at least once:
kdb global-mount
The spec plugin is a global plugin that copies metadata from the
spec
-namespace to other namespaces. That means, it reads the
specification, and makes sure that the configuration conforms to it. The
actual validation is done by the many validation plugins already present.
Lets start by saying a key is a long and must have at least the value 10:
kdb setmeta spec/example/longkey check/type long
Then we can create a key in a different namespace and see if the spec
plugin applies the metadata correctly:
kdb set /example/longkey 25
kdb lsmeta /example/longkey
Should now at least print check/type
.
By itself, this is useful for documentation of keys.
For example, the application developer says:
kdb setmeta spec/example/longkey description "Do not change"
kdb setmeta spec/example/longkey example 30
The user can retrieve this documentation by:
kdb getmeta /example/longkey description
But we want check/type
to be not only a documentation, but also
enforced.
Using kdb setmeta
extensively and always looking out that all plugins
are mounted correctly is error-prone. So instead, one can directly mount
the plugins as specified. For the example above one simply needs:
kdb setmeta spec/example mountpoint example.ecf
kdb spec-mount /example
Now, when we try to modify /example/longkey
it will be validated:
kdb set /example/longkey a
#> Error (#52) [...] long [not] matched [...] a
Based on the present metadata, the correct plugins (in this case type
because of the metadata check/type
) will be loaded.
We can also create a whole specification file, first mount the
specification and then the mountpoint according the specification, e.g
when we have battery.ini
in the folder $(dirname $(kdb file spec))
with following content:
[]
mountpoint = battery.ini
infos/plugins = ini
[level]
check/enum = 'critical', 'low', 'high', 'full'
Then we can use:
# mount the file itself:
kdb mount battery.ini spec/example/battery ni
# make sure all plugins are present (e.g. enum for check/enum):
kdb spec-mount /example/battery
Now lets verify if it worked:
kdb lsmeta /example/battery/level
# we see it has a check/enum
kdb getmeta /example/battery/level check/enum
# now we know allowed values
kdb set /example/battery/level low
# success, low is ok!
kdb set /example/battery/level wrong
# fails, not one of the allowed values!
The main idea of the spec-mount is: search a plugin for every specification (metadata) found in the spec-namespace.
In earlier versions kdb mount
failed when plugin dependencies were
not satisfied. Now dependencies will automatically be fulfilled, e.g.
kdb mount /etc/modules system/modules line
In earlier versions you would have got an error because of the missing
null
plugin. Now it simply adds the needed plugins.
The plugins given in the command-line used to be real plugins. Now also so-called providers are accepted.
To make providers useful we need to actually know which plugin is the
best candidate. To get the information we added a infos/status
clause
in the contract. In this clause the plugin developer adds many details
how well the plugin is tested, reviewed, documented, maintained and so
on. Based on this information, the best suited plugin will be chosen.
For example, you now can use:
kdb mount /etc/security/limits.conf system/limits augeas \
lens=Limits.lns logging
And the best suitable logger will automatically be chosen.
The configuration variable /sw/kdb/current/plugins
now allows
us to pass plugin configuration with the same syntax as the plugin
specification passed on the commandline. A subtle difference is that
thus the shell-splitting of arguments is missing, it is not possible to
include whitespaces in the plugin configuration that way.
Now it is also possible to include the same plugin multiple times and also give them individual names. This feature is essential for script-based plugins, e.g. you now might add:
kdb mount file.x /example/mountpoint \
lua#resolver script=resolver.lua \
lua#storage script=storage.lua
Furthermore, kdb mount
now supports recommendations, which can be
enabled with --with-recommends
. E.g. supplied to the mount command
using augeas above, comments will automatically transformed to metadata
to avoid cluttering of the real configuration.
Up to now, Elektra consisted only of a single shared library,
libelektra.so
. Not all symbols in it were relevant to end users, for
example, some were only needed by plugins. Others were only proposed and
not yet part of the stable API. And finally, other symbols were not needed
in some situations, e.g. the plugins do not need the kdb
interface.
Thus, we split libelektra.so
, so that only coherent parts are in the
same library:
libelektra-core.so
only contains the KeySet
data structure and
module loading. Every binary using Elektra should link against it.libelektra-kdb.so
contains the missing KDB
symbols. Together with
the core
they contain everything declared in kdb.h
.
Michael Zehender plans to have multiple variants of libelektra-kdb.so
that use different kinds of concurrency.
Headerfile: <kdb.h>
libelektra-ease.so
adds functionality missing in core
to make the
life for C programmers easier.
New headerfile: kdbease.h
libelektra-proposal.so
adds functionality proposed for core
. It
directly uses internal structures of core
, thus they always need to
have exactly the same version.
Headerfile: kdbproposal.h
The source code is now better organized by the introduction of a libs
folder. The explanation of every library can be found in
/src/libs/.
The rationale of the library split is documented here. Shortly put, it was needed for further evolution and allowing us to grow and enhance without getting a fat core.
Thanks to Manuel Mausz for fixing many bugs related to the library split and also adapting all the bindings for it.
To show that the split does not make Elektra slower, Mihael Pranjić made a small benchmark. The real time of benchmarks/large and revision 634ad924109d3cf5d9f83c33aacfdd341b8de17a
So it seems that the split does not influence the time of running elektrified processes.
Times were measured with time(1) and the median is calculated for 21 runs of benchmarks/large. This was done using scripts/benchmark_libsplit.sh
As always, the ABI and API is fully forward-compatible, i.e. programs compiled against an older 0.8 version of Elektra will continue to work (ABI) and you will be able to recompile every program without errors (API).
We added keyGetNamespace
which allows us to handle all namespaces
in a switch and to iterate all namespaces. This is essential, when
a new namespace is added, thus then the compiler can warn you about
every part where the new namespace is not yet considered. We currently
do not plan to add a new namespace, but better be safe than sorry.
The internal function keyCompare
now also detects any metadata
change.
libtools was nearly rewritten. Even though it is mostly API compatible
(you should not use the low-level Backend
anymore but instead use the
BackendBuilder
), it is certainly not ABI compatible. If you have an
undefined symbol: _ZN3kdb5tools7Backend9addPluginESsNS_6KeySetE
you need
to recompile your tool. Even the merging part has ABI incompatibility
(different size of _ZTVN3kdb5tools7merging14NewKeyStrategyE
).
Unfortunately, we still cannot guarantee compatibility in libtools
,
further changes are planned (e.g. implementing mounting of lazy plugins).
The python(2) and lua interfaces changed, an additional argument (the
plugin configuration) is passed to open
.
The INI plugin was rewritten, so many options changed in incompatible ways.
The default format plugin (e.g. for import/export) is no longer hard coded
to be dump
. Instead KDB_DEFAULT_STORAGE will be used.
To get KDB_DEFAULT_STORAGE you can use the constants plugin:
kdb mount-info
kdb get system/info/elektra/constants/cmake/KDB_DEFAULT_STORAGE
Thanks to Manuel Mausz plugins do no longer export any method other than
elektraPluginSymbol
. It now will fail if you directly linked against
plugins and did not correctly use their public interface. Please
use the module loading and access functions via the contract.
The CMake and Pkgconfig Files now only link against elektra-core
and
elektra-kdb
. If you used some symbols not present in kdb.h
, your
application might not work anymore.
libelektra.so
is still present for compatibility reasons. It should
not be used for new applications. Some unimportant parts, however,
moved to the "sugar" libraries. E.g. the symbol elektraKeyCutNamePart
is no longer part of libelektra.so
.
When you use kdbOpen
in Elektra as first step it reads mountpoint
configuration from /elektra
. This step is the only hard coded one,
and all other places of the KDB's tree can be customized as desired
via mounting.
The bootstrapping now changed, so that /elektra
is not part of the
default configuration default.ecf
(or as configured with KDB_DB_FILE
),
but instead we use elektra.ecf
(or as configured with KDB_DB_INIT
).
This behavior solves the problem that default.ecf
was read twice
(and even differently, once for /elektra
and once for /
).
To be fully compatible with previous mountpoints, Elektra will still read
mountpoints from default.ecf
as long as elektra.ecf
is not present.
To migrate the mountpoints to the new method, simply use:
kdb upgrade-bootstrap
which basically exports system/elektra/mountpoints
, then does kdb rm -r system/elektra/mountpoints
so that default.ecf
will be without an
mountpoint and thus the compatibility mode does not apply anymore. As
last step it will import again what it exported before.
We already highlighted the new spec
plugin, but also other plugins
were improved at many places. Small other changes are:
assign/condition
syntax,
thanks to Thomas Waseryajl
(the json parser and generator) now also accepts the
type string
and yields better warnings on wrong types.type
plugin.Larger changes were done in the following plugins:
The INI plugin was rewritten and a huge effort was taken so that it
fully-round-trips and additionally preserves all comments and ordering.
Currently, it is brand new. It is planned that it will replace dump
in the future.
Currently is has some minor problems when used as KDB_DEFAULT_STORAGE. You can avoid most problems by mounting a different file into root:
kdb mount root.ini /
Read here about the details.
A huge thanks to Thomas Waser.
Thanks to Thomas Waser rename
is now fixed for cascading keys.
Additionally, it does not change the sync
status of the keys so
that notification plugins work properly afterwards.
The crypto plugin is a facility for securing sensitive Keys by symmetric encryption of the value. It acts as a filter plugin and it will only operate on Keys, which have the metakey „crypto/encrypt“ set.
The key derivation is still work-in-progress, so the plugin does not work with kdb yet. A planned method for key derivation is to utilize the gpg-agent.
For now the plugin requires the following Keys within the plugin configuration in order to work properly:
Please note that this method of key input is for testing purposes only and should never be used in a productive environment!
Thanks to Peter Nirschl, especially the patience for also supporting different platforms where dependencies need to be handled differently.
A technical preview of a new tool was added: kdb editor
allows you
to edit any part of Elektra’s configuration with any editor and any
syntax. It uses 3-way merging and other stable technology, but it
currently does not provides a way to abort editing. So you only should
use it with care.
The tool kdb list
now searches in the rpath for libraries and thus
will also find plugins not present at compile-time (using glob
).
Additionally, it sorts the plugins by infos/status
score, which can
also be printed with -v
. The last plugins printed are the ones ranked
highest.
When running as root, kdb
will now use the system
namespace when
writing configuration to cascading key names.
Long paths are cumbersome to enter in the CLI. Thus one can define
bookmarks now. Bookmarks are key names that start with +
. They are
only recognized by the kdb
tool or tools that explicitly have support
for it. Applications should not depend on the presence of a bookmark. For
example, if you set the bookmark kdb:
kdb set user/sw/elektra/kdb/#0/current/bookmarks
kdb set user/sw/elektra/kdb/#0/current/bookmarks/kdb user/sw/elektra/kdb/#0/current
You are able to use:
kdb ls +kdb/bookmarks
kdb set +kdb/format ini
The kdb tool got much more robust when the initial configuration is broken, no man page viewer is present or Elektra was installed wrongly.
The --help
usage is unified and improved.
The new key naming conventions are now used for
configuration of the kdb
-tool itself: /sw/elektra/kdb/#0/%/
and /sw/elektra/kdb/#0/current/
are additionally read. The option
-p
/--profile
is now supported for every command, it allows to fetch
configuration from /sw/elektra/kdb/#0/<profile>/
instead of current
.
KDB is more robust when it cannot fetch its own configuration due to
KDB errors.
Thanks to Kurt Micheli the code guidelines are now properly documented. Thanks to René Schwaiger we also provide a style file for clang-format.
Furthermore we unified and fixed the source:
elektra*
functions for allocationSince we now only use C++11, we applied clang-modernize
which simplified
many loops and replaced many 0
to nullptr
. Additionally, we added
override
and default
at many places.
We removed all places where we had ifdefs
to use auto_ptr
if no
modern smart pointer is available.
Because of these changes there is no easy way to compile Elektra without C++11 support, except by avoiding the C++ parts all together.
The C++ KeySet
now also supports a get
to retrieve whole containers
at once. By specializing KeySetTypeWrapper
you can support your own
containers. Currently only map<string, T>
is supported (T is any type
supported by Key::get
).
If you haven't removed it from your flags already, there is no use
anymore to set ENABLE_CXX11
.
The documentation was improved vastly. Most thanks to Kurt Micheli who did a lot of editing and fixed many places throughout the documentation Also thanks to Michael Zehender who added two paragraphs in the main README.md.
Key names of applications should be called /sw/org/app/#0/current
,
where current
is the default profile (non given). org
and
app
is supposed to not contain /
and be completely lowercase.
Key names are documented here.
See also here. The main
reason for long paths is the provided flexibility in the future
(e.g. to use profiles and have a compatible path for new major versions
of configuration). By using bookmarks, users should not be confronted
by it too often.
Thanks to Kurt Micheli, developers are now warned during compilation on broken links in Markdown. The output format is the same as for gcc. Additionally, the Markdown documentation of plugins now get a proper title in the pdf and html output of doxygen.
Raffael Pancheri again updated qt-gui with many nice improvements:
BackendBuilder
is now used, which automatically takes cares of the correct ordering of pluginsElektra 0.8.14 now in Debian with qt-gui, man pages, thanks to Pino Toscano read more here
Thanks to Gustavo Alvarez for updating and splitting the packages on Arch Linux!
Thanks to Harald Geyer, Elektra is now packaged for OpenWRT. We fixed a number of cross-compilation issues and now officially support building against musl libc, with one minor limitation: RPATH works differently on musl so you need to install all plugins directly in /usr/lib/ or set LD_LIBRARY_PATH. Report any bugs in Harald's OpenWRT packaging issue tracker.
elektra-export-symbols
and
elektra-export-symbols
and can be installed using INSTALL_BUILD_TOOLS
(by default off). This is needed for cross-compilation.
Thanks to Harald Geyer for reporting.Read about other packages here.
(
and )
in source,
thanks to René SchwaigerYou can download the release from here and now also here on GitHub
This release tarball now is also available signed by me using gpg
already built API documentation can be found here
Subscribe to the RSS feed to always get the release notifications.
For any questions and comments, please contact the Mailing List the issue tracker on GitHub or by mail elektra@markus-raab.org.
For more information, see https://libelektra.org
Best regards, Markus