\hypertarget{group__meta}{}\section{Meta Data proposal+compatibility}
\label{group__meta}\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}


Meta data proposal+compatibility methods.  


Collaboration diagram for Meta Data proposal+compatibility\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=326pt]{group__meta}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
const char $\ast$ \hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{key\+Comment} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Return a pointer to the real internal {\ttfamily key} comment. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}{key\+Get\+Comment\+Size} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Calculates number of bytes needed to store a key comment, including final N\+U\+LL. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{key\+Get\+Comment} (const Key $\ast$key, char $\ast$returned\+Comment, size\+\_\+t max\+Size)
\begin{DoxyCompactList}\small\item\em Get the key comment. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment} (Key $\ast$key, const char $\ast$new\+Comment)
\begin{DoxyCompactList}\small\item\em Set a comment for a key. \end{DoxyCompactList}\item 
uid\+\_\+t \hyperlink{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}{key\+Get\+U\+ID} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Get the user ID of a key. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}{key\+Set\+U\+ID} (Key $\ast$key, uid\+\_\+t uid)
\begin{DoxyCompactList}\small\item\em Set the user ID of a key. \end{DoxyCompactList}\item 
gid\+\_\+t \hyperlink{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}{key\+Get\+G\+ID} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Get the group ID of a key. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}{key\+Set\+G\+ID} (Key $\ast$key, gid\+\_\+t gid)
\begin{DoxyCompactList}\small\item\em Set the group ID of a key. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_gaae575bd86a628a15ee45baa860522e75}{key\+Set\+Dir} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Set mode so that key will be recognized as directory. \end{DoxyCompactList}\item 
mode\+\_\+t \hyperlink{group__meta_gabc0cec592ce3b77e9bc33dbc8e8f6bdc}{key\+Get\+Mode} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Return the key mode permissions. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}{key\+Set\+Mode} (Key $\ast$key, mode\+\_\+t mode)
\begin{DoxyCompactList}\small\item\em Set the key mode permissions. \end{DoxyCompactList}\item 
time\+\_\+t \hyperlink{group__meta_ga6b05da399c3c78904969ef39f191b0eb}{key\+Get\+A\+Time} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Get last time the key data was read from disk. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_ga995d8b84731673c88c7c01f3fed538b9}{key\+Set\+A\+Time} (Key $\ast$key, time\+\_\+t atime)
\begin{DoxyCompactList}\small\item\em Update the atime information for a key. \end{DoxyCompactList}\item 
time\+\_\+t \hyperlink{group__meta_ga57689eb5691679071463b777ae786ae9}{key\+Get\+M\+Time} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Get last modification time of the key on disk. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_ga481d8997187992fe4bbf288bc8ef4db7}{key\+Set\+M\+Time} (Key $\ast$key, time\+\_\+t mtime)
\begin{DoxyCompactList}\small\item\em Update the mtime information for a key. \end{DoxyCompactList}\item 
time\+\_\+t \hyperlink{group__meta_ga2c213c120cbe02201278ef7fb8cd94be}{key\+Get\+C\+Time} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Get last time the key metadata was changed from disk. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_ga9f502ecab8ab43f0b17220fcc95f3fa5}{key\+Set\+C\+Time} (Key $\ast$key, time\+\_\+t ctime)
\begin{DoxyCompactList}\small\item\em Update the ctime information for a key. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_gab8b30dfabb0867bd6899e60e7bd193a2}{elektra\+Key\+Cmp\+Order} (const Key $\ast$ka, const Key $\ast$kb)
\begin{DoxyCompactList}\small\item\em Compare the order metadata of two keys. \end{DoxyCompactList}\item 
void \hyperlink{group__meta_ga166c65c4eb2d758ced57b0bd74fb9a57}{elektra\+Meta\+Array\+Add} (Key $\ast$key, const char $\ast$meta\+Name, const char $\ast$value)
\begin{DoxyCompactList}\small\item\em creates an metadata array or appends another element to an existing metadata array e.\+g. \end{DoxyCompactList}\item 
Key\+Set $\ast$ \hyperlink{group__meta_gacee3e2d9285dd2bde975a09fdbe50502}{elektra\+Meta\+Array\+To\+KS} (Key $\ast$key, const char $\ast$meta\+Name)
\begin{DoxyCompactList}\small\item\em Create a {\ttfamily Key\+Set} from a metakey array. \end{DoxyCompactList}\item 
int \hyperlink{group__meta_gaadfae80314be2415a7654fe8a0d2ee82}{elektra\+Sort\+Topology} (Key\+Set $\ast$ks, Key $\ast$$\ast$array)
\begin{DoxyCompactList}\small\item\em topological sorting \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{group__meta_ga04ceef7845af79a2628a2d4e9217bbb5}{elektra\+Meta\+Array\+To\+String} (Key $\ast$key, const char $\ast$meta\+Name, const char $\ast$delim)
\begin{DoxyCompactList}\small\item\em returns the metakey array as a string separated by delim \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Meta data proposal+compatibility methods. 

In versions before Elektra 0.\+8 only limited metadata was available. Now any metadata can be added. These A\+PI methods are implementations of the 0.\+7 A\+PI using 0.\+8 metadata.

Additionally, new suggestions can be made here.

It is planned that these methods will be generated from doc/\+M\+E\+T\+A\+D\+A\+T\+A.\+ini and moved to a separate library. Currently, you should better avoid the methods and directly use \hyperlink{group__keymeta}{metainfo } instead. 

\subsection{Function Documentation}
\mbox{\Hypertarget{group__meta_gab8b30dfabb0867bd6899e60e7bd193a2}\label{group__meta_gab8b30dfabb0867bd6899e60e7bd193a2}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!elektra\+Key\+Cmp\+Order@{elektra\+Key\+Cmp\+Order}}
\index{elektra\+Key\+Cmp\+Order@{elektra\+Key\+Cmp\+Order}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{elektra\+Key\+Cmp\+Order()}{elektraKeyCmpOrder()}}
{\footnotesize\ttfamily int elektra\+Key\+Cmp\+Order (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{ka,  }\item[{const Key $\ast$}]{kb }\end{DoxyParamCaption})}



Compare the order metadata of two keys. 

\begin{DoxyReturn}{Returns}
a number less than, equal to or greater than zero if the order of k1 is found, respectively, to be less than, to match, or be greater than the order of k2. If one key is N\+U\+LL, but the other isn\textquotesingle{}t, the key which is not N\+U\+LL is considered to be greater. If both keys are N\+U\+LL, they are considered to be equal. If one key does have an order metadata but the other has not, the key with the metadata is considered greater. If no key has metadata, they are considered to be equal.
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em ka} & key to compare with \\
\hline
{\em kb} & other key to compare with \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group__meta_ga166c65c4eb2d758ced57b0bd74fb9a57}\label{group__meta_ga166c65c4eb2d758ced57b0bd74fb9a57}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!elektra\+Meta\+Array\+Add@{elektra\+Meta\+Array\+Add}}
\index{elektra\+Meta\+Array\+Add@{elektra\+Meta\+Array\+Add}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{elektra\+Meta\+Array\+Add()}{elektraMetaArrayAdd()}}
{\footnotesize\ttfamily void elektra\+Meta\+Array\+Add (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{const char $\ast$}]{meta\+Name,  }\item[{const char $\ast$}]{value }\end{DoxyParamCaption})}



creates an metadata array or appends another element to an existing metadata array e.\+g. 

Key $\ast$key = key\+New(\char`\"{}user/test\char`\"{}, K\+E\+Y\+\_\+\+E\+ND); elektra\+Meta\+Array\+Add(key, \char`\"{}test\char`\"{}, \char`\"{}val0\char`\"{}); key now has \char`\"{}test/\#0\char`\"{} with value \char`\"{}val0\char`\"{} as metadata elektra\+Meta\+Array\+Add(key, \char`\"{}test\char`\"{}, \char`\"{}val1\char`\"{}); appends \char`\"{}test/\#1\char`\"{} with value \char`\"{}val1\char`\"{} to key


\begin{DoxyParams}{Parameters}
{\em key} & the key the metadata should be added to \\
\hline
{\em meta\+Name} & the name of the metakey array parent \\
\hline
{\em value} & the value of the newly appended metakey \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group__meta_gacee3e2d9285dd2bde975a09fdbe50502}\label{group__meta_gacee3e2d9285dd2bde975a09fdbe50502}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!elektra\+Meta\+Array\+To\+KS@{elektra\+Meta\+Array\+To\+KS}}
\index{elektra\+Meta\+Array\+To\+KS@{elektra\+Meta\+Array\+To\+KS}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{elektra\+Meta\+Array\+To\+K\+S()}{elektraMetaArrayToKS()}}
{\footnotesize\ttfamily Key\+Set$\ast$ elektra\+Meta\+Array\+To\+KS (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{const char $\ast$}]{meta\+Name }\end{DoxyParamCaption})}



Create a {\ttfamily Key\+Set} from a metakey array. 

For example, the following function call


\begin{DoxyCode}
\hyperlink{group__meta_gacee3e2d9285dd2bde975a09fdbe50502}{elektraMetaArrayToKS}(
        \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew} (\textcolor{stringliteral}{"/a"}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"b, c"},
                \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"dep"},    \textcolor{stringliteral}{"#1"},
                \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"dep/#0"}, \textcolor{stringliteral}{"/b"},
                \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"dep/#1"}, \textcolor{stringliteral}{"/c"}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}),
        \textcolor{stringliteral}{"dep"});
\end{DoxyCode}


returns a {\ttfamily Key\+Set} containing the keys {\ttfamily \char`\"{}dep/\#0\char`\"{}} with value {\ttfamily \char`\"{}/b\char`\"{}} and {\ttfamily \char`\"{}dep/\#1\char`\"{}} with value {\ttfamily \char`\"{}/c\char`\"{}}.

If no meta key array is found, null is returned. The returned {\ttfamily Key\+Set} must be freed with {\ttfamily ks\+Del}

\begin{DoxyReturn}{Returns}
a keyset containing all the metakeys of the metakey array 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em key} & the key containing the metakey array \\
\hline
{\em meta\+Name} & the name of the metakey array parent \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group__meta_ga04ceef7845af79a2628a2d4e9217bbb5}\label{group__meta_ga04ceef7845af79a2628a2d4e9217bbb5}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!elektra\+Meta\+Array\+To\+String@{elektra\+Meta\+Array\+To\+String}}
\index{elektra\+Meta\+Array\+To\+String@{elektra\+Meta\+Array\+To\+String}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{elektra\+Meta\+Array\+To\+String()}{elektraMetaArrayToString()}}
{\footnotesize\ttfamily char$\ast$ elektra\+Meta\+Array\+To\+String (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{const char $\ast$}]{meta\+Name,  }\item[{const char $\ast$}]{delim }\end{DoxyParamCaption})}



returns the metakey array as a string separated by delim 


\begin{DoxyParams}{Parameters}
{\em key} & the key containing the metakey array \\
\hline
{\em meta\+Name} & the name of the metakey array parent \\
\hline
{\em delim} & delimiter for the records in the returned string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a string containing all metakey values separated by \char`\"{}delim\char`\"{} 
\end{DoxyReturn}
\mbox{\Hypertarget{group__meta_gaadfae80314be2415a7654fe8a0d2ee82}\label{group__meta_gaadfae80314be2415a7654fe8a0d2ee82}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!elektra\+Sort\+Topology@{elektra\+Sort\+Topology}}
\index{elektra\+Sort\+Topology@{elektra\+Sort\+Topology}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{elektra\+Sort\+Topology()}{elektraSortTopology()}}
{\footnotesize\ttfamily int elektra\+Sort\+Topology (\begin{DoxyParamCaption}\item[{Key\+Set $\ast$}]{ks,  }\item[{Key $\ast$$\ast$}]{array }\end{DoxyParamCaption})}



topological sorting 


\begin{DoxyParams}{Parameters}
{\em array} & the array where the sorted keys will be stored in topological order. Nothing will be written into an array if \\
\hline
{\em ks} & is the keyset that should be sorted. Dependencies and order is defined by metakeys.\\
\hline
\end{DoxyParams}

\begin{DoxyItemize}
\item the \char`\"{}dep/\#\char`\"{} metakeys e.\+g. the Key $\ast$k = key\+New (\char`\"{}/a\char`\"{}, K\+E\+Y\+\_\+\+V\+A\+L\+UE, \char`\"{}b, c\char`\"{}, K\+E\+Y\+\_\+\+M\+E\+TA, \char`\"{}dep\char`\"{}, \char`\"{}\#1\char`\"{}, K\+E\+Y\+\_\+\+M\+E\+TA, \char`\"{}dep/\#0\char`\"{}, \char`\"{}/b\char`\"{}, K\+E\+Y\+\_\+\+M\+E\+TA, \char`\"{}dep/\#1\char`\"{}, \char`\"{}/c\char`\"{}, K\+E\+Y\+\_\+\+E\+ND), \char`\"{}dep\char`\"{}); depends on Key \char`\"{}/b\char`\"{} and Key \char`\"{}/c\char`\"{}.
\item if \char`\"{}order\char`\"{} metakeys are defined for the keys the algorithm tries to resolves them by that order using lexical comparison. You should prefer {\ttfamily \#0} array syntax.
\end{DoxyItemize}

Duplicated and reflexive dep entries are ignored.

The algorithm used is a mixture of Kahn and B\+FS. Furthermore the algorithm does not use recursion.

First a B\+FS with the keys sorted by \char`\"{}order\char`\"{} is used. Then all dependencies (recursively) of every key is collected.


\begin{DoxyRetVals}{Return values}
{\em 1} & on success \\
\hline
{\em 0} & for cycles \\
\hline
{\em -\/1} & for invalid dependencies \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{group__meta_gac89fd319783b3457db45b4c09e55274a}\label{group__meta_gac89fd319783b3457db45b4c09e55274a}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Comment@{key\+Comment}}
\index{key\+Comment@{key\+Comment}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Comment()}{keyComment()}}
{\footnotesize\ttfamily const char$\ast$ key\+Comment (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Return a pointer to the real internal {\ttfamily key} comment. 

This is a much more efficient version of \hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{key\+Get\+Comment()} and you should use it if you are responsible enough to not mess up things. You are not allowed to change anything in the memory region the returned pointer points to.

\hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{key\+Comment()} returns \char`\"{}\char`\"{} when there is no key\+Comment. The reason is 
\begin{DoxyCode}
key=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(0);
\hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{keySetComment}(key,\textcolor{stringliteral}{""});
\hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{keyComment}(key); \textcolor{comment}{// you would expect "" here}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}(key);
\end{DoxyCode}


See \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} for more information on comments.

\begin{DoxyNote}{Note}
Note that the Key structure keeps its own size field that is calculated by library internal calls, so to avoid inconsistencies, you must never use the pointer returned by \hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{key\+Comment()} method to set a new value. Use \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} instead.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to the internal managed comment 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & when there is no comment \\
\hline
{\em 0} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}{key\+Get\+Comment\+Size()} for size and \hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{key\+Get\+Comment()} as alternative 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga6b05da399c3c78904969ef39f191b0eb}\label{group__meta_ga6b05da399c3c78904969ef39f191b0eb}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+A\+Time@{key\+Get\+A\+Time}}
\index{key\+Get\+A\+Time@{key\+Get\+A\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+A\+Time()}{keyGetATime()}}
{\footnotesize\ttfamily time\+\_\+t key\+Get\+A\+Time (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Get last time the key data was read from disk. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000020}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


Every \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} might update the access time of a key. You get information when the key was read the last time from the database.

You will get 0 when the key was not read already.

Beware that multiple copies of keys with \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} might have different atimes because you \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} one, but not the other. You can use this information to decide which key is the latest.


\begin{DoxyParams}{Parameters}
{\em key} & Key to get information from. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the time you got the key with \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & on key that was never \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} \\
\hline
{\em (time\+\_\+t)-\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga995d8b84731673c88c7c01f3fed538b9}{key\+Set\+A\+Time()} 

\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}\label{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+Comment@{key\+Get\+Comment}}
\index{key\+Get\+Comment@{key\+Get\+Comment}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+Comment()}{keyGetComment()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Get\+Comment (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key,  }\item[{char $\ast$}]{returned\+Comment,  }\item[{size\+\_\+t}]{max\+Size }\end{DoxyParamCaption})}



Get the key comment. 

\hypertarget{group__meta_comment}{}\subsection{Comments}\label{group__meta_comment}
A Key comment is description for humans what this key is for. It may be a textual explanation of valid values, when and why a user or administrator changed the key or any other text that helps the user or administrator related to that key.

Don\textquotesingle{}t depend on a comment in your program. A user is always allowed to remove or change it in any way he wants to. But you are allowed or even encouraged to always show the content of the comment to the user and allow him to change it.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
{\em returned\+Comment} & pre-\/allocated memory to copy the comments to \\
\hline
{\em max\+Size} & number of bytes that will fit returned\+Comment \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes actually copied to {\ttfamily returned\+String}, including final N\+U\+LL 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & if the string is empty \\
\hline
{\em -\/1} & on N\+U\+LL pointer \\
\hline
{\em -\/1} & if max\+Size is 0, not enough to store the comment or when larger then S\+S\+I\+Z\+E\+\_\+\+M\+AX \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}{key\+Get\+Comment\+Size()}, \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}\label{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+Comment\+Size@{key\+Get\+Comment\+Size}}
\index{key\+Get\+Comment\+Size@{key\+Get\+Comment\+Size}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+Comment\+Size()}{keyGetCommentSize()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Get\+Comment\+Size (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Calculates number of bytes needed to store a key comment, including final N\+U\+LL. 

Use this method to know to size for allocated memory to retrieve a key comment.

See \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} for more information on comments.

For an empty key name you need one byte to store the ending N\+U\+LL. For that reason 1 is returned.


\begin{DoxyCode}
 \textcolor{keywordtype}{char} *buffer;
 buffer = \hyperlink{internal_8c_a35cdc2e5caed3454cb73b4fc7f37858c}{elektraMalloc} (\hyperlink{group__meta_ga0dd737fadc16d4cf16720d17f066a9d3}{keyGetCommentSize} (key));
\textcolor{comment}{// use this buffer to store the comment}
\textcolor{comment}{// pass keyGetCommentSize (key) for maxSize}
\end{DoxyCode}



\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes needed 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & if there is no comment \\
\hline
{\em -\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{key\+Get\+Comment()}, \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga2c213c120cbe02201278ef7fb8cd94be}\label{group__meta_ga2c213c120cbe02201278ef7fb8cd94be}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+C\+Time@{key\+Get\+C\+Time}}
\index{key\+Get\+C\+Time@{key\+Get\+C\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+C\+Time()}{keyGetCTime()}}
{\footnotesize\ttfamily time\+\_\+t key\+Get\+C\+Time (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Get last time the key metadata was changed from disk. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000024}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


You will get 0 when the key was not read already.

Any changed field in metadata will influence the ctime of a key.

This time is not updated if only value or comment are changed.

Not changed keys will not update this time, even after \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}.

It is possible that other keys written to disc influence this time if the backend is not grained enough.


\begin{DoxyParams}{Parameters}
{\em key} & Key to get information from. \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga9f502ecab8ab43f0b17220fcc95f3fa5}{key\+Set\+C\+Time()} 
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em (time\+\_\+t)-\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxyReturn}{Returns}
the metadata change time 
\end{DoxyReturn}
\mbox{\Hypertarget{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}\label{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+G\+ID@{key\+Get\+G\+ID}}
\index{key\+Get\+G\+ID@{key\+Get\+G\+ID}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+G\+I\+D()}{keyGetGID()}}
{\footnotesize\ttfamily gid\+\_\+t key\+Get\+G\+ID (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Get the group ID of a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000015}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}
\hypertarget{group__meta_GID}{}\subsection{G\+ID}\label{group__meta_GID}
The group ID is a unique identification for every group present on a system. Keys will belong to root (0) as long as you did not get their real G\+ID with \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}.

Unlike U\+ID users might change their group. This makes it possible to share configuration between some users.

A fresh key will have (gid\+\_\+t)-\/1 also known as the group nogroup. It means that the key is not related to a group ID at the moment.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the system\textquotesingle{}s G\+ID of the key 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em (gid\+\_\+t)-\/1} & on N\+U\+LL key or currently unknown ID \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}{key\+Set\+G\+I\+D()}, \hyperlink{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}{key\+Get\+U\+I\+D()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_gabc0cec592ce3b77e9bc33dbc8e8f6bdc}\label{group__meta_gabc0cec592ce3b77e9bc33dbc8e8f6bdc}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+Mode@{key\+Get\+Mode}}
\index{key\+Get\+Mode@{key\+Get\+Mode}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+Mode()}{keyGetMode()}}
{\footnotesize\ttfamily mode\+\_\+t key\+Get\+Mode (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Return the key mode permissions. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000018}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


Default is 0664 (octal) for keys and 0775 for directory keys which used \hyperlink{group__meta_gaae575bd86a628a15ee45baa860522e75}{key\+Set\+Dir()}.

The defaults are defined with the macros K\+D\+B\+\_\+\+F\+I\+L\+E\+\_\+\+M\+O\+DE and K\+D\+B\+\_\+\+D\+I\+R\+\_\+\+M\+O\+DE.

For more information about the mode permissions see \hyperlink{group__meta_mode}{Modes}.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
mode permissions of the key 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em K\+D\+B\+\_\+\+F\+I\+L\+E\+\_\+\+M\+O\+DE} & as defaults \\
\hline
{\em (mode\+\_\+t)-\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}{key\+Set\+Mode()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga57689eb5691679071463b777ae786ae9}\label{group__meta_ga57689eb5691679071463b777ae786ae9}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+M\+Time@{key\+Get\+M\+Time}}
\index{key\+Get\+M\+Time@{key\+Get\+M\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+M\+Time()}{keyGetMTime()}}
{\footnotesize\ttfamily time\+\_\+t key\+Get\+M\+Time (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Get last modification time of the key on disk. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000022}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


You will get 0 when the key was not read already.

Everytime you change value or comment and \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()} the key the mtime will be updated. When you \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} the key, the atime is set appropriate.

Not changed keys may not even passed to kdb\+Set\+\_\+backend() so it will not update this time, even after \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}.

It is possible that other keys written to disc influence this time if the backend is not grained enough.

If you add or remove a key the key thereunder in the hierarchy will update the mtime if written with \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()} to disc.


\begin{DoxyParams}{Parameters}
{\em key} & Key to get information from. \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga481d8997187992fe4bbf288bc8ef4db7}{key\+Set\+M\+Time()} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
the last modification time 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em (time\+\_\+t)-\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}\label{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Get\+U\+ID@{key\+Get\+U\+ID}}
\index{key\+Get\+U\+ID@{key\+Get\+U\+ID}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Get\+U\+I\+D()}{keyGetUID()}}
{\footnotesize\ttfamily uid\+\_\+t key\+Get\+U\+ID (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Get the user ID of a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000013}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}
\hypertarget{group__meta_UID}{}\subsection{U\+ID}\label{group__meta_UID}
The user ID is a unique identification for every user present on a system. Keys will belong to root (0) as long as you did not get their real U\+ID with \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}.

Although usually the same, the U\+ID of a key is not related to its owner.

A fresh key will have no U\+ID.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the system\textquotesingle{}s U\+ID of the key 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em (uid\+\_\+t)-\/1} & on N\+U\+LL key \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}{key\+Get\+G\+I\+D()}, \hyperlink{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}{key\+Set\+U\+I\+D()}, \hyperlink{owner_8c_a35922a017bee8b4bcb493bbdfad9d6f5}{key\+Get\+Owner()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga995d8b84731673c88c7c01f3fed538b9}\label{group__meta_ga995d8b84731673c88c7c01f3fed538b9}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+A\+Time@{key\+Set\+A\+Time}}
\index{key\+Set\+A\+Time@{key\+Set\+A\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+A\+Time()}{keySetATime()}}
{\footnotesize\ttfamily int key\+Set\+A\+Time (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{time\+\_\+t}]{atime }\end{DoxyParamCaption})}



Update the atime information for a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000021}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


When you do manual sync of keys you might also update the atime to make them indistinguishable.

It can also be useful if you work with keys not using a keydatabase.


\begin{DoxyParams}{Parameters}
{\em key} & The Key object to work with \\
\hline
{\em atime} & The new access time for the key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga6b05da399c3c78904969ef39f191b0eb}{key\+Get\+A\+Time()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}\label{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+Comment@{key\+Set\+Comment}}
\index{key\+Set\+Comment@{key\+Set\+Comment}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+Comment()}{keySetComment()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Set\+Comment (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{const char $\ast$}]{new\+Comment }\end{DoxyParamCaption})}



Set a comment for a key. 

A key comment is like a configuration file comment. See \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()} for more information.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
{\em new\+Comment} & the comment, that can be freed after this call. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes actually saved including final N\+U\+LL 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & when the comment was freed (new\+Comment N\+U\+LL or empty string) \\
\hline
{\em -\/1} & on N\+U\+LL pointer or memory problems \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{key\+Get\+Comment()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga9f502ecab8ab43f0b17220fcc95f3fa5}\label{group__meta_ga9f502ecab8ab43f0b17220fcc95f3fa5}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+C\+Time@{key\+Set\+C\+Time}}
\index{key\+Set\+C\+Time@{key\+Set\+C\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+C\+Time()}{keySetCTime()}}
{\footnotesize\ttfamily int key\+Set\+C\+Time (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{time\+\_\+t}]{ctime }\end{DoxyParamCaption})}



Update the ctime information for a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000025}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}



\begin{DoxyParams}{Parameters}
{\em key} & The Key object to work with \\
\hline
{\em ctime} & The new change metadata time for the key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga2c213c120cbe02201278ef7fb8cd94be}{key\+Get\+C\+Time()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_gaae575bd86a628a15ee45baa860522e75}\label{group__meta_gaae575bd86a628a15ee45baa860522e75}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+Dir@{key\+Set\+Dir}}
\index{key\+Set\+Dir@{key\+Set\+Dir}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+Dir()}{keySetDir()}}
{\footnotesize\ttfamily int key\+Set\+Dir (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Set mode so that key will be recognized as directory. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000017}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


The function will add all executable bits.


\begin{DoxyItemize}
\item Mode 0200 will be translated to 0311
\item Mode 0400 will be translated to 0711
\item Mode 0664 will be translated to 0775
\end{DoxyItemize}

The macro K\+D\+B\+\_\+\+D\+I\+R\+\_\+\+M\+O\+DE (defined to 0111) will be used for that.

The executable bits show that child keys are allowed and listable. There is no way to have child keys which are not listable for anyone, but it is possible to restrict listing the keys to the owner only.


\begin{DoxyItemize}
\item Mode 0000 means that it is a key not read or writable to anyone.
\item Mode 0111 means that it is a directory not read or writable to anyone. But it is recognized as directory to anyone.
\end{DoxyItemize}

For more about mode see \hyperlink{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}{key\+Set\+Mode()}.

It is not possible to access keys below a not executable key. If a key is not writeable and executable \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()} will fail to access the keys below. If a key is not readable and executable \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} will fail to access the keys below.


\begin{DoxyParams}{Parameters}
{\em key} & the key to set permissions to be recognized as directory. \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}{key\+Set\+Mode()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}\label{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+G\+ID@{key\+Set\+G\+ID}}
\index{key\+Set\+G\+ID@{key\+Set\+G\+ID}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+G\+I\+D()}{keySetGID()}}
{\footnotesize\ttfamily int key\+Set\+G\+ID (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{gid\+\_\+t}]{gid }\end{DoxyParamCaption})}



Set the group ID of a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000016}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


See \hyperlink{group__meta_GID}{G\+ID} for more information about group I\+Ds.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
{\em gid} & is the group ID \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL key \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}{key\+Get\+G\+I\+D()}, \hyperlink{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}{key\+Set\+U\+I\+D()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}\label{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+Mode@{key\+Set\+Mode}}
\index{key\+Set\+Mode@{key\+Set\+Mode}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+Mode()}{keySetMode()}}
{\footnotesize\ttfamily int key\+Set\+Mode (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{mode\+\_\+t}]{mode }\end{DoxyParamCaption})}



Set the key mode permissions. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000019}{Deprecated}]This A\+PI is obsolete. It is only a mapping to key\+Set\+Meta(key, \char`\"{}mode\char`\"{}, str) which should be preferred.\end{DoxyRefDesc}


The mode consists of 9 individual bits for mode permissions. In the following explanation the octal notation with leading zero will be used.

Default is 0664 (octal) for keys and 0775 for directory keys which used \hyperlink{group__meta_gaae575bd86a628a15ee45baa860522e75}{key\+Set\+Dir()}.

The defaults are defined with the macros K\+D\+B\+\_\+\+F\+I\+L\+E\+\_\+\+M\+O\+DE and K\+D\+B\+\_\+\+D\+I\+R\+\_\+\+M\+O\+DE.

\begin{DoxyNote}{Note}
libelektra 0.\+7.\+0 only allows 0775 (directory keys) and 0664 (other keys). More will be added later in a sense of the description below.
\end{DoxyNote}
\hypertarget{group__meta_mode}{}\subsection{Modes}\label{group__meta_mode}
0000 is the most restrictive mode. No user might read, write or execute the key.

Reading the key means to get the value by \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}.

Writing the key means to set the value by \hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}.

Execute the key means to make a step deeper in the hierarchy. But you must be able to read the key to be able to list the keys below. See also \hyperlink{group__meta_gaae575bd86a628a15ee45baa860522e75}{key\+Set\+Dir()} in that context. But you must be able to write the key to be able to add or remove keys below.

0777 is the most relaxing mode. Every user is allowed to read, write and execute the key, if he is allowed to execute and read all keys below.

0700 allows every action for the current user, identified by the uid. See \hyperlink{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}{key\+Get\+U\+I\+D()} and \hyperlink{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}{key\+Set\+U\+I\+D()}.

To be more specific for the user the single bits can elect the mode for read, write and execute. 0100 only allows executing which gives the information that it is a directory for that user, but not accessible. 0200 only allows reading. This information may be combined to 0300, which allows execute and reading of the directory. Last 0400 decides about the writing permissions.

The same as above is also valid for the 2 other octal digits. 0070 decides about the group permissions, in that case full access. Groups are identified by the gid. See \hyperlink{group__meta_ga46a95e81d7d7f4e3eb59e60e5f3738c0}{key\+Get\+G\+I\+D()} and \hyperlink{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}{key\+Set\+G\+I\+D()}. In that example everyone with a different uid, but the gid of the the key, has full access.

0007 decides about the world permissions. This is taken into account when neither the uid nor the gid matches. So that example would allow everyone with a different uid and gid of that key gains full access.


\begin{DoxyParams}{Parameters}
{\em key} & the key to set mode permissions \\
\hline
{\em mode} & the mode permissions \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL key \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_gabc0cec592ce3b77e9bc33dbc8e8f6bdc}{key\+Get\+Mode()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_ga481d8997187992fe4bbf288bc8ef4db7}\label{group__meta_ga481d8997187992fe4bbf288bc8ef4db7}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+M\+Time@{key\+Set\+M\+Time}}
\index{key\+Set\+M\+Time@{key\+Set\+M\+Time}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+M\+Time()}{keySetMTime()}}
{\footnotesize\ttfamily int key\+Set\+M\+Time (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{time\+\_\+t}]{mtime }\end{DoxyParamCaption})}



Update the mtime information for a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000023}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}



\begin{DoxyParams}{Parameters}
{\em key} & The Key object to work with \\
\hline
{\em mtime} & The new modification time for the key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga57689eb5691679071463b777ae786ae9}{key\+Get\+M\+Time()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}\label{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}} 
\index{Meta Data proposal+compatibility@{Meta Data proposal+compatibility}!key\+Set\+U\+ID@{key\+Set\+U\+ID}}
\index{key\+Set\+U\+ID@{key\+Set\+U\+ID}!Meta Data proposal+compatibility@{Meta Data proposal+compatibility}}
\subsubsection{\texorpdfstring{key\+Set\+U\+I\+D()}{keySetUID()}}
{\footnotesize\ttfamily int key\+Set\+U\+ID (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key,  }\item[{uid\+\_\+t}]{uid }\end{DoxyParamCaption})}



Set the user ID of a key. 

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000014}{Deprecated}]This A\+PI is obsolete.\end{DoxyRefDesc}


See \hyperlink{group__meta_UID}{U\+ID} for more information about user I\+Ds.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
{\em uid} & the user ID to set \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on N\+U\+LL key or conversion error \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}{key\+Set\+G\+I\+D()}, \hyperlink{group__meta_gacaa5060e67b03f50ae49a3620c54bc46}{key\+Get\+U\+I\+D()}, \hyperlink{owner_8c_a35922a017bee8b4bcb493bbdfad9d6f5}{key\+Get\+Owner()} 
\end{DoxySeeAlso}
