\label{doc_news_2015-04-03_0_8_11_md_md_doc_news_2015_04_03_0_8_11}%
\Hypertarget{doc_news_2015-04-03_0_8_11_md_md_doc_news_2015_04_03_0_8_11}%

\begin{DoxyItemize}
\item guid\+: 7d4647d4-\/4131-\/411e-\/9c2a-\/2aca39446e18
\item author\+: Markus Raab
\item pub\+Date\+: Fri, 03 Apr 2015 02\+:39\+:37 +0200
\item short\+Desc\+: adds specification namespace \& numerous improvements
\end{DoxyItemize}

From the beginning of the Elektra Initiative, Elektra aimed at avoiding hard coded information in the application and to make the application\textquotesingle{}s configuration more transparent. While avoiding any paths to files was reality from the first released Elektra version, now also hard coding default values, fallback mechanisms and even Elektra’s paths to keys can be avoided.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2803}{}\doxysection{How does that work?}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2803}
Elektra 0.\+8.\+11 introduces a so called specification for the application\textquotesingle{}s configuration. It is located below its own namespace {\ttfamily spec} (next to user and system).

Once the base path is known, the user can find out all Elektra paths used by an application, using\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb ls spec/basepath}

\end{DoxyCode}


Keys in {\ttfamily spec} allow us to specify which keys are read by the application, which fallback it might have and which is the default value using metadata. The implementation of these features happened in {\ttfamily ks\+Lookup}. When cascading keys (those starting with {\ttfamily /}) are used following features are now available (in the metadata of respective {\ttfamily spec}-\/keys)\+:


\begin{DoxyItemize}
\item {\ttfamily override/\#}\+: use these keys {\itshape in favour} of the key itself (note that {\ttfamily \#} is the syntax for arrays, e.\+g. {\ttfamily \#0} for the first element, {\ttfamily \#\+\_\+10} for the 11th and so on)
\item {\ttfamily namespace/\#}\+: instead of using all namespaces in the predefined order, one can specify which namespaces should be searched in which order
\item {\ttfamily fallback/\#}\+: when no key was found in any of the (specified) namespaces the {\ttfamily fallback}-\/keys will be searched
\item {\ttfamily default}\+: this value will be used if nothing else was found
\end{DoxyItemize}

This technique does not only give you the obvious advantages, but also provides complete transparency how a program will fetch a configuration value. In practice that means that\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb get "{}/sw/app/\#0/promise"{}}

\end{DoxyCode}


will give you the {\itshape exact same value} as the application uses when it lookups the key {\ttfamily promise}. Many {\ttfamily if}s and hard coded values are avoided, we simply fetch and lookup the configuration by following code\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{Key *parentKey = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}/sw/app/\#0"{}}, KEY\_CASCADING\_NAME, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdbGet}}(\mbox{\hyperlink{namespacekdb}{kdb}}, ks, parentKey);}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_gad65d2cdcbb5381194a1688e169af8a83}{ksLookupByName}}(ks, \textcolor{stringliteral}{"{}/sw/app/\#0/promise"{}}, 0);}

\end{DoxyCode}


We see in that example that only Elektra paths are hard coded in the application. But those can be found out easily, completely without looking in the source code. The technique is simple\+: append a logger plugin and the KDB base path is printed to\+:


\begin{DoxyItemize}
\item stdout in the case of the plugin tracer
\item syslog in the case of the plugin syslog
\item journald in the case of the plugin journald
\end{DoxyItemize}

What we do not see in the program above are the default values and fallbacks. They are only present in the so specification (namespace {\ttfamily spec}). Luckily, the specification are key-\/value pairs, too. So we do not have to learn something new, e.\+g. using the ni plugin we can specify\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{[promise]}
\DoxyCodeLine{default=20}
\DoxyCodeLine{fallback/\#0=/somewhere/else}
\DoxyCodeLine{namespace/\#0=user}

\end{DoxyCode}



\begin{DoxyEnumerate}
\item When this file is mounted to {\ttfamily spec/sw/app/\#0} we specify, that for the key {\ttfamily /sw/app/\#0/promise} only the namespace {\ttfamily user} should be used.
\item If this key was not found, but {\ttfamily /somewhere/else} is present, we will use this key instead. The {\ttfamily fallback} technique is very powerful\+: it allows us to have (recursive) links between applications. In the example above, the application is tricked in receiving e.\+g. the key {\ttfamily user/somewhere/else} when {\ttfamily promise} was not available.
\item The value {\ttfamily 20} will be used as default, even if no configuration file is found.
\end{DoxyEnumerate}

Note that the fallback, override and cascading works on {\itshape key level}, and not like most other systems have implemented, on configuration {\itshape file level}.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2804}{}\doxysection{Namespaces}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2804}
The specification gives the namespaces clearer semantics and purpose. Key names starting with a namespace are connected to a configuration source. E.\+g. keys starting with\+:


\begin{DoxyItemize}
\item {\ttfamily user} are keys from the home directory of the current user
\item {\ttfamily system} are keys from the {\ttfamily /etc} directory of the current system
\item {\ttfamily spec} are keys from the specification directory (configurable with {\ttfamily KDB\+\_\+\+DB\+\_\+\+SPEC}, typically {\ttfamily /usr/share/elektra/specification})
\end{DoxyItemize}

When a key name starts with an {\ttfamily /} it means that it is looked up by specification. Such a cascading key is not really present in the keyset (except when a default value was found). They are neither received nor stored by {\ttfamily kdb\+Get} and {\ttfamily kdb\+Set}.

Applications shall only lookup using cascading keys (starting with {\ttfamily /}). If no specification is present, cascading of all namespaces is used as before.

Elektra will (always) continue to work for applications that do not have a specification. We strongly encourage you, however, to write such a specification, because\+:


\begin{DoxyItemize}
\item it helps the administrator to know which keys exist
\item it documents the keys (including lookup behaviour and default value)
\item and many more advantages to come in future releases..
\end{DoxyItemize}

For a tutorial how to actually elektrify an application and for more background to Elektra, \href{https://github.com/ElektraInitiative/libelektra/blob/master/doc/tutorials/application-integration.md}{\texttt{ read this document}}.

For a full list of proposed and implemented metadata, \href{https://github.com/ElektraInitiative/libelektra/blob/master/doc/help/elektra-namespaces.md}{\texttt{ read this document}}.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2805}{}\doxysection{Simplification in the merging framework}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2805}
As it turned out the concept of very granular merge strategies was hard to understand for users of the three-\/way merging framework that emerged in the last year\textquotesingle{}s GSoC. While this granularity is desirable for flexibility, we additionally wanted something easy to use. For that reason merge configurations were introduced. These are simply preconfigured configurations for a merger that arrange required strategies for the most common merging scenarios. Especially they make sure that meta merging is handled correctly.

Have a look at the changes in the example \href{https://github.com/ElektraInitiative/libelektra/blob/master/src/libs/tools/examples/merging.cpp}{\texttt{ /src/libs/tools/examples/merging.cpp}} for an glimpse of the simplifications.

A big thanks to Felix Berlakovich!

The header files will be installed to /usr/include/elektra/merging, but they are subject to be changed in the future (e.\+g. as they did in this release).

From the merging improvements some minor incompatibility happened in {\ttfamily kdb import}. Not all merging strategies that worked in 0.\+8.\+10 work anymore. Luckily, now its much simpler to choose the strategies.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2806}{}\doxysection{API}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2806}
The main API kdb.\+h has two added lines. First a new method was added\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{ssize\_t \mbox{\hyperlink{group__keyname_gaa70593a2c772c4b7bc33423b9b10a270}{keyAddName}}(Key *key, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *addName);}

\end{DoxyCode}


This method is already used heavily in many parts. Contrary to {\ttfamily key\+Set\+Base\+Name} and {\ttfamily key\+Add\+Base\+Name} it allows us to extend the path with more than one Element at once, i.\+e. {\ttfamily /} are not escaped.

The other new line is the new enum value {\ttfamily KEY\+\_\+\+FLAGS}. This feature allows bindings to use any flags in key\+New without actually building up variable argument lists. (Thanks to Manuel Mausz)

As always, API+\+ABI is stable and compatible.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2807}{}\doxysection{Proposed}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2807}
Many new functions are proposed and can be found in \href{https://doc.libelektra.org/api/0.8.11/html}{\texttt{ the doxygen docu}} and in \href{https://github.com/ElektraInitiative/libelektra/blob/master/src/include/kdbproposal.h}{\texttt{ kdbproposal.\+h}}.

Noteworthy is the method {\ttfamily key\+Get\+Namespace} which allows us to query all namespaces. Since this release we changed every occurrence of namespaces (except documentation) with switch-\/statements around {\ttfamily key\+Get\+Namespace}. This allows us to add new more namespaces more easily. (Although its currently not planned to add further namespaces.)

Finally, a bunch of new lookup options were added, which might not be useful for the public API (they allow us to disable the specification-\/aware features mentioned in the beginning).\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2808}{}\doxysection{Obsolete and removed concepts}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2808}
\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2809}{}\doxysubsection{umount}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2809}
The concept that backends have a name (other than their mountpoint) is now gone. Backends will simply be named with their escaped mountpath below system/elektra/mountpoints without any confusing additional name.

Unmounting still works with the mountpath.

Removing this concept makes Elektra easier to understand and it also removes some bugs. E.\+g. having mountpoints which do not differ except having a {\ttfamily \+\_\+} instead of a {\ttfamily /} would have caused problems with the automatic name generation of Elektra 0.\+8.\+10.

Old mountpoints need to be removed with their 0.\+8.\+10 name ({\ttfamily \+\_\+} instead of {\ttfamily /}).\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2810}{}\doxysubsection{directory keys}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2810}
Additionally, the so called directory keys were also removed. Elektra was and still is completely key-\/value based. The {\ttfamily /} separator is only used for mountpoints.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2811}{}\doxysubsection{fstab}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2811}
The plugin fstab is also improved\+: Slashes in mountpoints are escaped properly with the internal escaping engine of \mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{key\+Add\+Base\+Name()}} (i.\+e. without any problematic {\ttfamily /} replacements).\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2812}{}\doxysubsection{dirname}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2812}
get\+Dir\+Name() was removed from C++, gi-\/lua, gi-\/python2, gi-\/python3, swig-\/lua, swig-\/python2 and swig-\/python3. It was never present in C and did not fit well with \mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} (which returns an unescaped name, which is not possible for the dirname). (Thanks to Manuel Mausz)\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2813}{}\doxysubsection{invalid parent names}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2813}
While empty (=invalid) names are still accepted as parent\+Name to {\ttfamily kdb\+Get} and {\ttfamily kdb\+Set} for compatibility reasons, but the parent\+Key


\begin{DoxyCode}{0}
\DoxyCodeLine{Key *parentKey = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}

\end{DoxyCode}


should be used instead (if you want to get or store everything). They have identical behaviour, except that invalid names (that cannot be distinguished from empty names) will produce a warning. In the next major version invalid parent\+Names will produce an error.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2814}{}\doxysection{KDB Behaviour}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2814}
It is now enforced that before a \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}} on a specific path a \mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}} on that path needs to be done. This was always documented that way and is the only way to correctly detect conflicts, updates and missing configuration files. Error \#107 will be reported on violations.

Additionally, the handling with missing files was improved. Empty keysets for a mountpoint now will remove a file. Such an empty file is always up-\/to-\/date. Removing files has the same atomicity guarantees as other operations.

The concurrency behaviour is at a very high level\+: as expected many processes with many threads can each concurrently write to the key database, without any inconsistent states\+: This is noted here because Elektra works on standard configuration files without any guarding processes.

Filesystem problems, e.\+g. permission, now always lead to the same errors (\#9, \#75, \#109, \#110), regardless of the storage plugin.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2815}{}\doxysection{Qt-\/\+Gui 0.\+0.\+6}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2815}
Raffael Pancheri was very busy and did a lot of stabilizing work\+:


\begin{DoxyItemize}
\item Added markdown converter functionality for plugin documentation
\item Integrated help (Whats this?)
\item Added credits to other authors
\item do not show storage/resolver plugins if a plugin of that kind has been selected
\item added menu to newkey toolbar button to allow new array entries
\item added option to include a configuration keyset when adding a plugin
\item show included keys when creating the plugin configuration
\item Added all storageplugins to namefilters
\item Reimplement Error\+Dialog
\item Added undo/redo of all commands and correctly update the view
\item modified Tool\+Tip size
\item Color animation on search results
\item Refactored Buttons to accept shortcuts
\item Updated Translations
\item Colors are now customizeable
\item Many small fixes
\end{DoxyItemize}

The gui is already used and the remaining small bugs (see github) are going to be fixed soon. One of the highlights is undo for nearly every action, so nothing prevents you from trying it out!

A huge thanks to Raffael Pancheri for his contributions. His thesis can be found at \href{https://www.libelektra.org/ftp/elektra/publications/pancheri2015gui.pdf}{\texttt{ here}}.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2816}{}\doxysection{Bug fixing}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2816}

\begin{DoxyItemize}
\item fix issues with escaped backslashes in front of slashes
\item atomic commits across namespaces work again
\item memleak on Read\+File error in ni plugin
\item {\ttfamily kdb getmeta} reports errorcode if key, but no meta was found
\item {\ttfamily ks\+Lookup} now will also work if a key of the keyset is used as search-\/key (aliasing problem fixed by dup() on namelock)
\item resolver regex does not match to wrongly written plugins
\item jna plugin is now named libelektra-\/0.\+8.\+11.\+jar, with proper symbolic link to current version, for every CMake version
\item fix bashism ({\ttfamily \$\+RANDOM})
\item new keys are correctly renamed, fixes Open\+ICC (thanks to Felix Berlakovich)
\item comments in host keys are correctly restored (thanks to Felix Berlakovich)
\item output stream in type checking is no longer locale dependent (thanks to Manuel Mausz)
\item cmake uninstall works again
\item simplify {\ttfamily CMAKE\+\_\+\+DL\+\_\+\+LIBS} (thanks to Manuel Mausz)
\end{DoxyItemize}\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2817}{}\doxysection{Further gems}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2817}

\begin{DoxyItemize}
\item Examples were improved, added (e.\+g. cascading, namespace) and included in \href{https://doc.libelektra.org/api/0.8.11/html}{\texttt{ Doxygen docu}}.
\item \href{https://github.com/ElektraInitiative/libelektra/blob/master/doc/METADATA.ini}{\texttt{ METADATA specification}} was nearly completely rewritten (thanks to Felix Berlakovich)
\item benchmarks were greatly enhanced (run-\/time+heap profiling), and some important performance improvements were done
\item All plugins now use the cmake function {\ttfamily add\+\_\+plugin} (thanks to Ian Donnelly for most of the work)
\item data directory (keysets as C-\/files) is now shared between different kinds of test suites.
\item many more tests were added, e.\+g. distribution tests, KDB API tests; and allocation tests were readded
\item now all kdb commands accept cascading keys.
\item More compiler warning-\/flags are added and many warnings are fixed
\item cleanup of old unused {\ttfamily key\+Name} methods
\item The key {\ttfamily system/elektra/mountpoints} itself was always created and a left-\/over on a freshly installed system after the unit tests run the first time. The physical presence of the key is now irrelevant and it won\textquotesingle{}t be created automatically.
\item Bash completion was greatly improved (thanks to Manuel Mausz)
\item Configure scripts were refactored and are now much shorter (thanks to Manuel Mausz)
\item New Debian build agents were added that are magnitutes faster than the old ones (a big thanks to Manuel Mausz)
\item Many KDB tests, written in C, lua and python were added (thanks to Manuel Mausz)
\item SWIG3 is preferred when available
\item add the plugin counter that counts how often the methods of a plugin are called
\item {\ttfamily kdb list-\/tools} is now advertised in {\ttfamily kdb -\/-\/help}
\item mac\+OS support was greatly improved, thanks to Peter Nirschl and Kai-\/\+Uwe Behrmann. The feature rich resolver, now also works for mac\+OS. wresolver is now only needed for mingw.
\item Elektra still compiles with gcc (also mingw variants), icc and clang.
\end{DoxyItemize}\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2818}{}\doxysection{Further Notes}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2818}
With 471 files changed, 27978 insertions(+), 11512 deletions(-\/) this release is huge. With 773 commits over four month much more changes happened which did not find their place in these release notes, even though the notes are much less detailed than usual.

Thanks for all contributions that are not enlisted here!

For any questions and comments, please contact the \href{https://lists.sourceforge.net/lists/listinfo/registry-list}{\texttt{ Mailing List}} or \href{mailto:elektra@markus-raab.org}{\texttt{ elektra@markus-\/raab.\+org}}.\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2819}{}\doxysection{Get It!}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2819}
You can download the release from \href{http://www.markus-raab.org/ftp/elektra/releases/elektra-0.8.11.tar.gz}{\texttt{ here}}


\begin{DoxyItemize}
\item name\+: elektra-\/0.\+8.\+11.\+tar.\+gz
\item size\+: 2022129
\item md5sum\+: c53a8151aab760851842d745e904a4f8
\item sha1\+: d7929d17d1a6529089d156f1910d87f678b84998
\item sha256\+: c20fefcfba62cc906228f9b55d1f411ef8f884ff9d75774a0dd4f8eb8f5b48f6
\end{DoxyItemize}

This release tarball now is also available \href{http://www.markus-raab.org/ftp/elektra/releases/elektra-0.8.11.tar.gz.gpg}{\texttt{ signed by me using gpg}}

already built API-\/\+Docu can be found \href{https://doc.libelektra.org/api/0.8.11/html/}{\texttt{ here}}\hypertarget{doc_news_2015-04-03_0_8_11_md_autotoc_md2820}{}\doxysection{Stay tuned!}\label{doc_news_2015-04-03_0_8_11_md_autotoc_md2820}
Subscribe to the \href{https://doc.libelektra.org/news/feed.rss}{\texttt{ new RSS feed}} to always get the release notifications.

\href{https://doc.libelektra.org/news/7d4647d4-4131-411e-9c2a-2aca39446e18.html}{\texttt{ Permalink to this NEWS entry}}

For more information, see \href{https://www.libelektra.org}{\texttt{ https\+://www.\+libelektra.\+org}}

Best regards, Markus 