Enumerations | |
enum | KDBErr { KDB_RET_OK = 0, KDB_RET_NULLKEY = EINVAL, KDB_RET_UNINITIALIZED = EINVAL, KDB_RET_NOKEY = ENOMSG, KDB_RET_NODATA = ENOMSG, KDB_RET_NOGROUP = ENOMSG, KDB_RET_NODESC = ENOMSG, KDB_RET_NODOMAIN = ENOMSG, KDB_RET_NOCRED = EACCES, KDB_RET_NOTIME = ENOMSG, KDB_RET_TRUNC = ENOBUFS, KDB_RET_TYPEMISMATCH = EILSEQ, KDB_RET_INVALIDKEY = EAFNOSUPPORT, KDB_RET_NOTFOUND = ENOENT } |
enum | KDBOptions { KDB_O_RECURSIVE = 1, KDB_O_DIR = 1<<1, KDB_O_NOVALUE = 1<<2 , KDB_O_STATONLY = 1<<4, KDB_O_INACTIVE = 1<<5, KDB_O_SORT = 1<<6, KDB_O_NFOLLOWLINK = 1<<7, KDB_O_CONDENSED = 1<<8, KDB_O_NUMBERS = 1<<9, KDB_O_XMLHEADERS = 1<<10 } |
Functions | |
int | kdbOpen () |
int | kdbClose () |
int | kdbGetValue (const char *keyname, char *returned, size_t maxSize) |
int | kdbSetValue (const char *keyname, const char *value) |
int | kdbGetValueByParent (const char *parentName, const char *baseName, char *returned, size_t maxSize) |
int | kdbSetValueByParent (const char *parentName, const char *baseName, const char *value) |
int | kdbGetKeyByParent (const char *parentName, const char *baseName, Key *returned) |
int | kdbGetKeyByParentKey (const Key *parent, const char *baseName, Key *returned) |
int | kdbGetChildKeys (const char *parentName, KeySet *returned, unsigned long options) |
int | kdbGetRootKeys (KeySet *returned) |
int | kdbStatKey (Key *key) |
int | kdbGetKey (Key *key) |
int | kdbSetKeys (KeySet *ks) |
int | kdbSetKey (Key *key) |
int | kdbRename (Key *key, const char *newName) |
int | kdbRemove (const char *keyName) |
int | kdbLink (const char *oldPath, const char *newKeyName) |
u_int32_t | kdbMonitorKeys (KeySet *interests, u_int32_t diffMask, unsigned long iterations, unsigned sleep) |
u_int32_t | kdbMonitorKey (Key *interest, u_int32_t diffMask, unsigned long iterations, unsigned sleep) |
To use them:
#include <kdb.h>
This is the class that accesses the storage backend. When writing a new backend, these are the methods you'll have to reimplement: kdbGetKey(), kdbSetKey(), kdbStatKey(), kdbRemove(), kdbRename(), kdbGetChildKeys()
And methods that is suggested to reimplement (but not needed) if you want them to get the benefits of your new backend: kdbOpen(), kdbClose(), kdbMonitorKey(), kdbMonitorKeys()
The other methods are higher level. They use the above methods to do their job, and generally don't have to be reimplemented for a different backend.
Language binding writers should follow the same rules:
|
Some return codes generated by the Elektra library. These are only specific Elektra errors, that the library sets in errno. Other error can be generated by system calls that the API uses. Then errno is propagated. A very robust program should check errno after each API call.
|
|
Options to change the default behavior of some methods. These options should be ORed.
|
|
Closes a session with the Key database. You should call this method when you finished your affairs with the key database. You can manipulate Key and KeySet objects after kdbClose(). This is the counterpart of kdbOpen().
Definition at line 153 of file localkdb.c. Referenced by commandExport(), and main(). |
|
Retrieve a number of inter-related keys in one shot. This is one of the most practicall methods of the library. Returns a KeySet with all retrieved keys. So if your application keys live bellow Option can be any of the following, ORed:
Definition at line 1100 of file localkdb.c. References _KeySet::end, KDB_O_DIR, KDB_O_INACTIVE, KDB_O_NFOLLOWLINK, KDB_O_NOVALUE, KDB_O_RECURSIVE, KDB_O_SORT, KDB_O_STATONLY, KDB_RET_NOCRED, kdbGetChildKeys(), kdbGetKey(), kdbStatKey(), keyClose(), keyGetFullName(), keyGetFullNameSize(), keyInit(), keyIsLink(), keySetName(), ksAppend(), ksAppendKeys(), ksInit(), _Key::next, _KeySet::size, and _KeySet::start. Referenced by commandEdit(), commandList(), and kdbGetChildKeys(). |
|
Fully retrieves the passed
Definition at line 1318 of file localkdb.c. References _Key::flags, KEY_FLAG_NEEDSYNC, and keyIsDir(). Referenced by commandEdit(), commandGet(), commandList(), commandMonitor(), commandSet(), kdbGetChildKeys(), kdbGetKeyByParent(), kdbGetKeyByParentKey(), kdbGetRootKeys(), kdbGetValue(), kdbMonitorKey(), and kdbSetValue(). |
|
Given a parent key name plus a basename, returns the key. So here you'll provide something like
Definition at line 982 of file localkdb.c. References kdbGetKey(), and keySetName(). |
|
Similar to previous, provided for convenience.
Definition at line 1001 of file localkdb.c. References kdbGetKey(), keyGetFullName(), keyGetFullNameSize(), and keySetName(). |
|
Returns a KeySet with all root keys currently recognized. Currently, the
Definition at line 1240 of file localkdb.c. References kdbGetKey(), keyInit(), keySetName(), ksAppend(), and ksInsert(). Referenced by commandList(). |
|
A high-level method to get a key value, by key name. This method is valid only for string keys. You should use other methods to get non-string keys.
Definition at line 867 of file localkdb.c. References kdbGetKey(), keyClose(), keyGetString(), keyInit(), and keySetName(). Referenced by kdbGetValueByParent(). |
|
Fills the
Definition at line 939 of file localkdb.c. References kdbGetValue(). |
|
Create a link key that points to other key.
Definition at line 1592 of file localkdb.c. References kdbSetKey(), keyClose(), keyInit(), keySetLink(), and keySetName(). Referenced by commandLink(). |
|
Monitor a key change. This method will block your program until one of the folowing happens:
If
If
If you don't have access rights to
If something from
Definition at line 1739 of file localkdb.c. References KDB_RET_NOCRED, KDB_RET_NOTFOUND, kdbGetKey(), KEY_FLAG_FLAG, KEY_FLAG_NEEDSYNC, keyClose(), keyCompare(), keyDup(), keyGetNameSize(), and keyInit(). Referenced by commandMonitor(), and kdbMonitorKeys(). |
|
Monitor a KeySet for some key change.
This method will scan the You may check the return code to see if some key changed, and get the updated key using ksCurrent().
Definition at line 1669 of file localkdb.c. References kdbMonitorKey(), ksCurrent(), ksNext(), and _KeySet::size. |
|
Opens a session with the Key database You should allways call this method before retrieving or commiting any keys to the database. Otherwise, consequences are unpredictable. To simply manipulate Key or KeySet objects, you don't need to open the key database before with this method.
Definition at line 136 of file localkdb.c. Referenced by commandExport(), and main(). |
|
Remove a key from the backend storage. This method is not recursive.
Definition at line 1562 of file localkdb.c. References keyClose(), keyInit(), and keySetName(). Referenced by commandEdit(), and commandRemove(). |
|
Rename a key.
Definition at line 1532 of file localkdb.c. References keyInit(), and keySetName(). |
|
Commits a key to the backend storage. If failed (see return), the
Definition at line 1404 of file localkdb.c. References _Key::data, _Key::dataSize, _Key::flags, KDB_RET_INVALIDKEY, KEY_FLAG_NEEDSYNC, keyClose(), keyGetAccess(), keyGetGID(), keyGetLink(), keyGetUID(), keyInit(), keyIsDir(), keyIsLink(), and keySetName(). Referenced by commandSet(), kdbLink(), kdbSetKeys(), and kdbSetValue(). |
|
Commits the
If some error occurs, kdbSetKeys() stops and returns whatever kdbSetKey() returned. The KeySet internal cursor is left on the key that generated the error (so you may check it latter with ksCurrent()). The internal kdbSetKey() also sets
Definition at line 1376 of file localkdb.c. References kdbSetKey(), keyNeedsSync(), ksCurrent(), and ksNext(). Referenced by commandEdit(), and commandImport(). |
|
A high-level method to set a value to a key, by key name. It will obviously check if key exists first, and keep its metadata. So you'll not loose the precious key comment. This will set a text key. So if the key was previously a binary, etc key, it will be retyped as text.
Definition at line 898 of file localkdb.c. References kdbGetKey(), kdbSetKey(), keyClose(), keySetName(), and keySetString(). Referenced by kdbSetValueByParent(). |
|
Sets the provided
Definition at line 957 of file localkdb.c. References kdbSetValue(). |
|
Retrieves only the meta-info of a key from backend storage. The bahavior may change from backend to backend. In the filesystem backend, it will make only a stat to the key. Info like comments and key data type are not retrieved.
Definition at line 1278 of file localkdb.c. References _Key::flags, KEY_FLAG_NEEDSYNC, keyIsLink(), keySetLink(), and _Key::recordSize. Referenced by commandList(), and kdbGetChildKeys(). |