1kded
2====
3
4kded is responsible for creating the sycoca file, i.e. the binary
5cache of servicetypes, mimetypes, and services for a particular user.
6
7It uses KDirWatch to monitor the directories containing .desktop files.
8When a file is added/removed, it waits 5 seconds (in case of series of
9updates), and then launches kbuildsycoca.
10
11kbuildsycoca recreates the sycoca file by:
12* parsing all .desktop files, replacing global ones by local ones (at any
13  level of the hierarchy)
14* creating all objects in memory
15* saving everything in the sycoca file (see below for ksycoca internals)
16* clearing all memory
17* notifying the applications that use ksycoca by a DBUS signal emitted to
18the ksycoca object (KSycoca::notifyDatabaseChanged()).
19
20Format of the sycoca database file
21==================================
22
23* Version
24
25List of factories
26 | * Factory id, Factory offset
27 | * Factory id, Factory offset
28 | * ...
29 | * 0
30
31* KDE prefixes
32* timestamp
33* KDE language
34* resource hash
35* list of all resource dirs
36
37For each factory
38 | Header
39 | * offset of the dict
40 | * offset of the beginning of the entries
41 | * offset of the end of the entries
42 | Rest of the header (factory-specific), for instance:
43 | * Offer-list offset
44 | * Mimetype-patterns index offset (fast patterns)
45 | * Mimetype-patterns index offset (other)
46 | * Entry size in the mimetype-patterns index ("fast" part)
47 |
48 | KSycocaEntries
49 | | * entry type
50 | | Entry
51 | | | entry-dependent information
52 | | ...
53 | |
54 | Dict
55 | | * hashtable size
56 | | Hash list
57 | | | * list of values used to compute a hash key
58 | | Hash table
59 | | | * id (positive = entry offset)
60 | | | * id (negative = - offset in duplicates list )
61 | | | * 0 if no entry for that hash value
62 | | Table of duplicates
63 | | |  * entry offset, key
64 | | |  * entry offset, key
65 |
66
67Offer list
68| * servicetype offset, service offset
69| * servicetype offset, service offset
70| * servicetype offset, service offset
71| * servicetype offset, service offset
72| * mimetype offset, service offset
73| * mimetype offset, service offset
74| * mimetype offset, service offset
75| * mimetype offset, service offset
76| * 0
77This allows to quickly find services associated with a servicetype.
78It does NOT reflect the user profile, which is stored in profilerc and
79implemented in KServiceTypeProfile.
80
81Mimetype patterns
82| Fast patterns (fixed size)
83| * Extension (padded to 4 chars), mimetype offset
84| * Extension (padded to 4 chars), mimetype offset
85| * Extension (padded to 4 chars), mimetype offset
86| Other patterns (variable size)
87| * Pattern (ex : *.*gf), mimetype offset
88| * Pattern (ex : Makefile*), mimetype offset
89| * ""
90
91The first one is designed for a binary search, since entries have a fixed size
92and are sorted by extension.
93The second one (10% of the mimetypes usually) is for a linear search.
94