Main Page | Modules | Data Structures | File List | Data Fields

The Elektra API

Elektra Initiative Overview

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

Using the Elektra Library

A C or C++ source file that wants to use Elektra should include:
 #include <kdb.h>

There is also a library that provides some optional XML manipulation methods called KDB Tools, and to use it you should include:

 #include <kdbtools.h>

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

Elektra API

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:

classes.png

Elektra Classes

Some general things you can do with each class are:

KeyDB

Key

KeySet

Key Names and Namespaces

There are 2 trees of keys: system and user

The "system" Subtree

It is provided to store system-wide configuration keys, that is, configurations that daemons and system services will use.

The "user" Subtree

Used to store user-specific configurations, like the personal settings of a user to certains programs

Rules for Key Names

When using Elektra to store your application's configuration and state, please keep in mind the following rules:
Generated on Sun Feb 19 10:05:36 2006 for Elektra Project by  doxygen 1.3.9.1