elektra-keytest (3) - Linux Manuals
NAME
Key :: Methods for Making Tests -
Methods to do various tests on Keys.
Functions
int keyNeedStat (const Key *key)
int keyNeedSync (const Key *key)
int keyNeedRemove (const Key *key)
int keyIsSystem (const Key *key)
int keyIsUser (const Key *key)
int keyIsBelow (const Key *key, const Key *check)
int keyIsDirectBelow (const Key *key, const Key *check)
int keyIsInactive (const Key *key)
int keyIsDir (const Key *key)
int keyIsBinary (const Key *key)
int keyIsString (const Key *key)
Detailed Description
Methods to do various tests on Keys.
To use them:
#include <kdb.h>
Parameters:
Returns:
0 if it is not below or if it is the same key
See also:
The function checks if the keytype is in the range between KEY_TYPE_BINARY and less than excluding KEY_TYPE_STRING. Then it will be interpreted as binary.
Make sure to use this function and don't test the binary type another way to ensure compatibility and to write less error prone programs.
Returns:
0 if it is not
-1 on NULL pointer
See also:
keyGetBinary(), keySetBinary()
Parameters:
Folder keys may also have value and comment. They are discern by having a executable bit set.
If any executable bit is set it will be recognized as a directory.
Note:
To know if you can access the directory, you need to check, if your
Accessing does not mean that you can get any value or comments below, see Mode for more information.
Parameters:
Returns:
-1 on NULL pointer
See also:
Parameters:
Returns:
0 if it is not below or if it is the same key
-1 on null pointer
See also:
In elektra terminology any key is inactive if the it's basename starts with '.'. Inactive keys must not have any meaning to applications, they are reserved for users and administrators.
To remove a whole hierarchy in elektra, don't forget to pass option_t::KDB_O_INACTIVE to kdbGet() to receive the inactive keys in order to remove them.
Otherwise you should not fetch these keys.
Parameters:
Returns:
-1 on NULL pointer or when key has no name
The function checks if the keytype is larger or equal KEY_TYPE_STRING. Then it will be considered as string type.
Make sure to use this function and don't test the string type another way to ensure compatibility and to write less error prone programs.
Returns:
0 if it is not
-1 on NULL pointer
See also:
keyGetString(), keySetString()
Parameters:
Parameters:
Returns:
-1 on NULL pointer
See also:
Parameters:
Returns:
-1 on NULL pointer
See also:
Ask if the key will be removed instead of writing in the key database when doing kdbSetKey() or kdbSet().
See also:
kdbSet(), kdbSetKey(), kdbRemove()
Parameters:
Returns:
-1 on NULL pointer
Ask if the key will be stat instead of get it from the key database completely doing kdbGetKey() or kdbGet(). This is useful if you are not interested in the value, comment or key type.
See also:
Parameters:
Returns:
-1 on NULL pointer
If any key modification took place the key will be flagged with KEY_FLAG_SYNC so that kdbSet() knows which keys were modified and which not.
After keyNew() the flag will normally be set, but after kdbGet() and kdbSet() the flag will be removed. When you modify the key the flag will be set again.
In your application you can make use of that flag to know if you changed something in a key after a kdbGet() or kdbSet().
Note:
See also:
Parameters:
Returns:
-1 on NULL pointer
Generated automatically by Doxygen for Elektra Projekt from the source code.
Function Documentation
int keyIsBelow (const Key * key, const Key * check)Check if the key check is below the key key or not.
Example:
key user/sw/app
check user/sw/app/key
returns true because check is below key
Example:
key user/sw/app
check user/sw/app/folder/key
returns also true because check is indirect below key
check the key to find the relative position of
int keyIsBinary (const Key * key)Check if a key is binary type.
int keyIsDir (const Key * key)Check if a key is directory key.
int keyIsDirectBelow (const Key * key, const Key * check)Check if the key check is direct below the key key or not.
Example:
key user/sw/app
check user/sw/app/key
returns true because check is below key
Example:
key user/sw/app
check user/sw/app/folder/key
does not return true, because there is only a indirect relation
check the key to find the relative position of
int keyIsInactive (const Key * key)Check whether a key is inactive or not.
int keyIsString (const Key * key)Check if a key is string type.
int keyIsSystem (const Key * key)Check whether a key is under the system namespace or not
int keyIsUser (const Key * key)Check whether a key is under the user namespace or not.
int keyNeedRemove (const Key * key)Ask if key is marked for permanent remove.
int keyNeedStat (const Key * key)Ask if key is marked for stat only.
int keyNeedSync (const Key * key)Test if a key needs to be synced to backend storage.
Author