The Elektra API
Elektra is an initiative to unify Linux/Unix configurations. It does that providing an hierarchical namespace to store configuration keys and their values, an API to access/modify them, and command line tools.
Everything about the initiative can be found at http://elektra.sf.net
A C or C++ source file that wants to use Elektra should include:
There is also a library that provides some optional XML manipulation methods called KDB Tools, and to use it you should include:
To link an executable with the Elektra library, the correct way is to use the pkg-config
tool:
bash$ cc `pkg-config --libs elektra` -o myapp myapp.c
Or, if you don't have pkg-config
:
bash$ cc -L /lib -lelektra -o myapp myapp.c
The API was written in pure C because Elektra was designed to be usefull even for the most basic system programs, which are all made in C. Also, being C, bindings to other languages can appear, as we already have for Python, Ruby, etc.
The API follows an Object Oriented design, and there are only 3 classes as shown by the figure:
Elektra Classes
Some general things you can do with each class are:
There are 2 trees of keys: system
and user
It is provided to store system-wide configuration keys, that is, configurations that daemons and system services will use.
Used to store user-specific configurations, like the personal settings of a user to certains programs
When using Elektra to store your application's configuration and state, please keep in mind the following rules:
- You are not allowed to create keys right under
system
or user
. - You are not allowed to create folder keys right under
system
or user
. They are reserved for very essential OS subsystems. - The keys for your application, called say MyApp, should be created under
system/sw/MyApp
and/or user/sw/MyApp
.
Generated on Sun Feb 19 10:05:36 2006 for Elektra Project by
1.3.9.1