\label{doc_decisions_1_in_discussion_spec_metadata_md_md_doc_decisions_1_in_discussion_spec_metadata}%
\Hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_md_doc_decisions_1_in_discussion_spec_metadata}%
 \hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1947}{}\doxysection{Problem}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1947}
To make storage-\/plugins suitable for {\ttfamily spec} they need to be able to store all the metadata as specified in \href{/home/jenkins/workspace/libelektra_master/doc/METADATA.ini}{\texttt{ METADATA.\+ini}}. Most file formats do not have support for that.

If metadata is merged from different namespaces, e.\+g., {\ttfamily spec\+:} and {\ttfamily user\+:}; metadata from one namespace might end up in keys of other namespaces, e.\+g.; metadata from {\ttfamily spec\+:} might end up in {\ttfamily user\+:}.\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1948}{}\doxysection{Constraints}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1948}

\begin{DoxyItemize}
\item We do not touch what is already described in the \mbox{\hyperlink{doc_tutorials_storage-plugins_md}{storage plugin tutorial}}.
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1949}{}\doxysection{Assumptions}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1949}

\begin{DoxyItemize}
\item Metadata can always safely merged from {\ttfamily spec\+:/} to other namespace.
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1950}{}\doxysection{Considered Alternatives}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1950}

\begin{DoxyItemize}
\item Store metadata in the comments like the {\ttfamily ini} plugin\+: this exposes internal metadata into the comments and can drastically affect the readability of a storage file. Comments should never be touched by a parser.
\item Designate metadata to be only for {\ttfamily spec\+:/} or to only for restoring configuration file formats. Rename metadata {\ttfamily $<$type$>$} in {\ttfamily spec\+:/} to {\ttfamily check/$<$type$>$} or {\ttfamily make/array}. This way no merging of metadata would be needed and by the name alone it would be clear to which namespace it belongs.
\item Do not support {\ttfamily array} or {\ttfamily type} if the underlying configuration file format does not support it. {\ttfamily spec-\/mount} could make sure that the storage plugin supports everything the underlying format needs.
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1951}{}\doxysection{Decision}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1951}
Do not store metadata unrelated to the configuration file structure in any namespace except in {\ttfamily spec\+:/}.


\begin{DoxyItemize}
\item Trying to store any other metadata in any other namespace leads to an error. E.\+g. {\ttfamily kdb set-\/meta user\+:/data metadata\+\_\+not\+\_\+suitable\+\_\+for\+\_\+storage\+\_\+plugins something} would fail (validated by {\ttfamily spec} plugin).
\item Metadata that is designed to be stored by storage plugins to preserve configuration file structure. E.\+g. {\ttfamily comment} or {\ttfamily order}, might be stored in any namespace.
\end{DoxyItemize}

Sometimes, the same metadata can be used in several namespaces but with different meanings and ways of serialization, e.\+g. {\ttfamily type} and {\ttfamily array}\+:


\begin{DoxyItemize}
\item In {\ttfamily spec\+:/} the metadata {\ttfamily array=} (empty value) means \char`\"{}this is an array\char`\"{}. If you give it a value e.\+g. {\ttfamily array=\#4} it means \char`\"{}this is an array with default size X\char`\"{} (e.\+g. {\ttfamily \#4} = size 5).
\item In any other namespace {\ttfamily array=} means \char`\"{}this is an empty array\char`\"{} and e.\+g. {\ttfamily array=\#4} means \char`\"{}this is an array with max index \#4\char`\"{}. {\ttfamily array=\#4} is not stored literally but inferred.
\item Either the storage plugin does not support arrays, then the metadata will be discarded on {\ttfamily kdb\+Set} but {\ttfamily spec} will keep on adding it for every {\ttfamily kdb\+Get}.
\item Or, if the storage plugin supports arrays, the data will be serialized as array (even if the metadata comes from {\ttfamily spec}) and as such available in the next {\ttfamily kdb\+Get} from the storage plugin to be validated by {\ttfamily spec}.
\end{DoxyItemize}

Use different storage plugins, or plugins with different configurations, for the {\ttfamily spec\+:/} namespace\+:


\begin{DoxyItemize}
\item {\ttfamily ni}
\item TOML with {\ttfamily meta} configuration
\end{DoxyItemize}

The {\ttfamily kdb mount} tool will add the {\ttfamily meta} plugin configuration when mounting a storage plugin to {\ttfamily spec\+:/}.\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1952}{}\doxysection{Rationale}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1952}

\begin{DoxyItemize}
\item We do not need a storage plugin suitable for everything.
\item The problems that internal metadata ends up in configuration files disappears.
\item The short names {\ttfamily type} and {\ttfamily array} can be used in specs.
\item Also simple storage plugins (like properties) can still be used with realistic specifications (that include array and/or type).
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1953}{}\doxysection{Implications}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1953}

\begin{DoxyItemize}
\item We need to have different (default) plugins in {\ttfamily spec\+:/} than in the other namespaces.
\item It can be confusing about which metadata we are speaking, e.\+g., {\ttfamily array} in {\ttfamily spec\+:/} has a quite different meaning to {\ttfamily array} in other namespaces.
\item The spec\+:/ meaning of array= must obviously be stored. The other meaning should never be stored explicitly and instead should be inferred from the stored data. Either by the storage plugin (e.\+g. JSON array) or by the spec plugin.
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1954}{}\doxysection{Related Decisions}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1954}

\begin{DoxyItemize}
\item \mbox{\hyperlink{doc_decisions_1_in_discussion_spec_expressiveness_md}{Spec Expressiveness}}
\item \mbox{\hyperlink{doc_decisions_4_partially_implemented_array_md}{Arrays}}
\end{DoxyItemize}\hypertarget{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1955}{}\doxysection{Notes}\label{doc_decisions_1_in_discussion_spec_metadata_md_autotoc_md1955}
