
\begin{DoxyItemize}
\item infos = Information about the blockresolver plugin is in keys below
\item infos/author = Thomas Waser \href{mailto:thomas.waser@libelektra.org}{\tt thomas.\+waser@libelektra.\+org}
\item infos/licence = B\+SD
\item infos/needs =
\item infos/provides = resolver
\item infos/recommends =
\item infos/placements = rollback getresolver setresolver commit
\item infos/status = unittest nodep libc configurable preview experimental difficult unfinished concept
\item infos/metadata =
\item infos/description = resolver for parts in a file configuration file
\end{DoxyItemize}

The {\ttfamily blockresolver} can be used to only resolve a tagged block inside a configuration file.

{\ttfamily blockresolver} extracts the requested block from the configurations file and writes it into a temporary file. Afterwards Elektra will only work on the temporary file until kdb\+Set is called. On kdb\+Set the contents of the temporary file will be merged with parts outside of the requested block from the original file.

\begin{DoxyVerb}`kdb mount -R blockresolver /path/to/my/file /mountpoint -c identifier="identifier-tag"`
\end{DoxyVerb}


where {\ttfamily identifier} specifies the tag {\ttfamily blockresolver} will search for in the configuration file.

A block consists of 2 parts\+:


\begin{DoxyItemize}
\item beginning\+: the identifier suffixed with {\ttfamily start}
\item end\+: the identifier suffixed with {\ttfamily stop}
\end{DoxyItemize}

Currently the identifier must be unique.


\begin{DoxyCode}
# Backup-and-Restore:system/tests/blockresolver

# create testfile
kdb set system/tests/blockfile $(mktemp)
echo 'text'                   >  $(kdb get system/tests/blockfile)
echo 'more text'              >> $(kdb get system/tests/blockfile)
echo 'some more text'         >> $(kdb get system/tests/blockfile)
echo '>>> block config start' >> $(kdb get system/tests/blockfile)
echo 'key1=val1'            >> $(kdb get system/tests/blockfile)
echo '>>> block config stop'  >> $(kdb get system/tests/blockfile)
echo 'text again'             >> $(kdb get system/tests/blockfile)
echo 'and more text'          >> $(kdb get system/tests/blockfile)
echo 'text'                   >> $(kdb get system/tests/blockfile)

sudo kdb mount -R blockresolver $(kdb get system/tests/blockfile) system/tests/blockresolver -c
       identifier=">>> block config" mini

# check testfile
cat $(kdb get system/tests/blockfile)
#> text
#> more text
#> some more text
#> >>> block config start
#> key1=val1
#> >>> block config stop
#> text again
#> and more text
#> text

# only the block between the tags is read!
kdb export system/tests/blockresolver mini
# STDOUT-REGEX: key1.*=.*val1

# add a new key to the resolved block
kdb set system/tests/blockresolver/key12 val12

cat $(kdb get system/tests/blockfile)
#> text
#> more text
#> some more text
#> >>> block config start
#> key1=val1
#> key12=val12
#> >>> block config stop
#> text again
#> and more text
#> text

# cleanup
kdb rm -r system/tests/blockresolver
rm $(kdb get system/tests/blockfile)
kdb rm system/tests/blockfile
sudo kdb umount system/tests/blockresolver
\end{DoxyCode}
 