
\begin{DoxyItemize}
\item infos = Information about ni plugin is in keys below
\item infos/author = Markus Raab \href{mailto:elektra@libelektra.org}{\tt elektra@libelektra.\+org}
\item infos/licence = B\+SD
\item infos/provides = storage/ini
\item infos/needs =
\item infos/placements = getstorage setstorage
\item infos/status = maintained unittest libc nodep
\item infos/metadata =
\item infos/description = Reads and writes the nickel ini format
\end{DoxyItemize}

This plugin uses the nickel library in order to read/write \hyperlink{doc_help_elektra-metadata_md}{metakeys} in the nickel ini format. It\textquotesingle{}s purpose is to be used in the {\ttfamily spec}-\/namespace or when any metadata should be stored.

For other applications, e.\+g. modifying {\ttfamily smb.\+conf} you should prefer the \hyperlink{autotoc_md288_src_plugins_ini_README_md}{ini plugin}.

To mount the ni plugin you can simply use\+:


\begin{DoxyCode}
kdb mount file.ini spec/ni ni
\end{DoxyCode}


The strength of this plugin is that it supports arbitrary meta data and the file format is still human readable. For example the following lines\+:


\begin{DoxyCode}
[key]
meta=foo
\end{DoxyCode}


specify that {\ttfamily key} has a metadata key {\ttfamily meta} containing the metavalue {\ttfamily foo}\+:


\begin{DoxyCode}
kdb meta-get user/ni/key meta
#> foo
\end{DoxyCode}


For the metadata of the parent key use the following syntax\+:


\begin{DoxyCode}
[]
meta=foo
\end{DoxyCode}


Line continuation works by ending the line with {\ttfamily \textbackslash{}\textbackslash{}} (a single backslash). If you want a line break at the end of the line, use {\ttfamily \textbackslash{}\textbackslash{}n\textbackslash{}\textbackslash{}}.

To export a {\ttfamily Key\+Set} in the nickel format use\+:


\begin{DoxyCode}
kdb export spec/ni ni > example.ni
\end{DoxyCode}


For in-\/detail explanation of the syntax (nested keys are not supported by the plugin) \href{/home/jenkins/workspace/libelektra_master-Q2SIBK3KE2NBEMJ4WVGJXAXCSCB77DUBUULVLZDKHQEV3WNDXBMA@2/src/plugins/ni/nickel-1.1.0/include/bohr/ni.h}{\tt see /src/plugins/ni/nickel-\/1.1.\+0/include/bohr/ni.h}

``{\ttfamily  @section autotoc\+\_\+md504 Mount the}ni{\ttfamily plugin at}spec/tests/ni` sudo kdb mount file.\+ini spec/tests/ni ni\hypertarget{autotoc_md501_autotoc_md505}{}\section{Add some metadata}\label{autotoc_md501_autotoc_md505}
kdb meta-\/set spec/tests/ni/key metakey metavalue kdb meta-\/set spec/tests/ni/key check/type char\hypertarget{autotoc_md501_autotoc_md506}{}\section{Retrieve metadata}\label{autotoc_md501_autotoc_md506}
kdb meta-\/ls spec/tests/ni/key \#$>$ check/type \#$>$ metakey kdb meta-\/get spec/tests/ni/key metakey \#$>$ metavalue\hypertarget{autotoc_md501_autotoc_md507}{}\section{Add and retrieve key values}\label{autotoc_md501_autotoc_md507}
kdb get spec/tests/ni/key \#$>$ kdb set spec/tests/ni/key value kdb set spec/tests/ni/key/to nothing kdb get spec/tests/ni/key \#$>$ value kdb get spec/tests/ni/key/to \#$>$ nothing\hypertarget{autotoc_md501_autotoc_md508}{}\section{Undo modifications}\label{autotoc_md501_autotoc_md508}
kdb rm -\/r spec/tests/ni sudo kdb umount spec/tests/ni ```\hypertarget{autotoc_md501_autotoc_md509}{}\subsection{Limitations}\label{autotoc_md501_autotoc_md509}

\begin{DoxyItemize}
\item Supports most Key\+Sets, but {\ttfamily kdb test} currently reports some errors (likely because of the U\+T\+F-\/8 handling happening within ni).
\item Keys have a random order when written out.
\item Comments are not preserved, they are simply removed.
\item Parse errors simply result in ignoring (and removing) these parts.
\end{DoxyItemize}\hypertarget{autotoc_md501_autotoc_md510}{}\subsection{Nickel}\label{autotoc_md501_autotoc_md510}
This plugin is based on the Nickel Library written by author\+: \href{mailto:charles@chaoslizard.org}{\tt charles@chaoslizard.\+org}

Nickel (Ni) has its strength in building up a hierarchical recursive Node structure which is perfect for parsing and generating ini files. With them arbitrary deep nested hierarchy are possible, but limited in a keyname of a fixed size.

The A\+PI of nickel is very suited for elektra, it can use {\ttfamily F\+I\+L\+E$\ast$} pointers (using that elektra could open and lock files), the node-\/hierarchy can be transformed to keysets, but it lacks many features like comments and types.

The format is more general than the kde-\/ini format, it can handle their configuration well, when the section names do not exceed the specified length. Nesting is only required in the first depth, any deeper is not understood by kde config parser.

The memory footprint is for a 190.\+000 (reduced to 35.\+000 when rewrote first ) line ini file with 1.\+1\+MB size is 16.\+88 MB. The sort order is not stable, even not with the same file rewritten again.

\href{https://lab.burn.capital/chaz-attic/bohr}{\tt bohr libraries} 