tests: Set G_DEBUG and other useful environment variables
[dconf.git] / README
blob049e1e3ddae4218fe6047669334eba95dee14db7
1 dconf is a simple key/value storage system that is heavily optimised for
2 reading.  This makes it an ideal system for storing user preferences
3 (which are read 1000s of times for each time the user changes one).  It
4 was created with this usecase in mind.
6 All preferences are stored in a single large binary file.  Layering of
7 preferences is possible using multiple files (ie: for site defaults).
8 Lock-down is also supported.  The binary file for the defaults can
9 optionally be compiled from a set of plain text keyfiles.
11 dconf has a partial client/server architecture.  It uses D-Bus.  The
12 server is only involved in writes (and is not activated in the user
13 session until the user modifies a preference).  The service is
14 stateless and can exit freely at any time (and is therefore robust
15 against crashes).  The list of paths that each process is watching is
16 stored within the D-Bus daemon itself (as D-Bus signal match rules).
18 Reads are performed by direct access (via mmap) to the on-disk database
19 which is essentially a hashtable.  For this reason, dconf reads
20 typically involve zero system calls and are comparable to a hashtable
21 lookup in terms of speed.  Practically speaking, in simple non-layered
22 setups, dconf is less than 10 times slower than GHashTable.
24 Writes are not optimised at all.  On some file systems, dconf-service
25 will call fsync() for every write, which can introduce a latency of up
26 to 100ms.  This latency is hidden by the client libraries through a
27 clever "fast" mechanism that records the outstanding changes locally (so
28 they can be read back immediately) until the service signals that a
29 write has completed.
31 dconf mostly targets Free Software operating systems.  It will
32 theoretically run on Mac OS but there isn't much point to that (since
33 Mac OS applications want to store preferences in plist files).  It is
34 not possible to use dconf on Windows because of the inability to rename
35 over a file that's still in use (which is what the dconf-service does on
36 every write).
38 The dconf API is not particularly friendly.  Because of this and the
39 lack of portability, you almost certainly want to use some sort of
40 wrapper API around it.  The wrapper API used by Gtk+ and GNOME
41 applications is GSettings, which is included as part of GLib.  GSettings
42 has backends for Windows (using the registry) and Mac OS (using property
43 lists) as well as its dconf backend and is the proper API to use for
44 graphical applications.
46 dconf itself attempts to maintain a rather low profile with respect to
47 dependencies.  For the most part, there is only a dependency on GLib.
49 With the exception of the bin/ directory, dconf is written in C using
50 libglib.  This is a very strong dependency due to the fact that dconf's
51 type system is GVariant.
53 The dconf-service has a dependency on libgio, as do the client libraries
54 that make use of GDBus (and the utilities that make use of those
55 libraries).
57 The standard client library is libdconf (in client/).  If you can't use
58 GSettings then you should probably want to use this next.
60 There is also a libdbus-1 based library.  It does not depend on libgio,
61 but still depends on libglib.  It is not recommended to use this library
62 unless you have a legacy dependency on libdbus-1 (such as in Qt
63 applications).
65 bin/ is written in Vala, hence the Vala compiler is required.
67 Installing dconf follows the typical meson dance:
69   meson builddir
70   ninja -C builddir
71   ninja -C builddir install
73 If you plan to contribute to dconf, please see the HACKING file.