summaryrefslogtreecommitdiffstats
path: root/kded/DESIGN
blob: 0fffb0456eafb23521ef8f122cefa0dcf4f58bed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
kded
====

kded is responsible for creating the sycoca file, i.e. the binary 
cache of servicetypes, mimetypes and services, for a particular user.

It uses KDirWatch to monitor the directories contain the .desktop files.
When a file is added/removed, it waits 5 seconds (in case of series of
updates), and then launches tdebuildsycoca.

tdebuildsycoca recreates the sycoca file by:
* parsing all .desktop files, replacing global ones by local ones (at any
  level of the hierarchy)
* creating all objects in memory
* saving everything in the sycoca file (see below for tdesycoca internals)
* clearing all memory
* notifying the applications that use tdesycoca by a DCOP call to the tdesycoca
object (KSycoca::notifyDatabaseChanged()).

Format of the sycoca database file
==================================

List of factories
 | * Factory id, Factory offset
 | * Factory id, Factory offset
 | * ...
 | * 0

Header
 | * Offer-list offset
 | * Mimetype-patterns index offset (fast patterns)
 | * Mimetype-patterns index offset (other)
 | * Entry size in the mimetype-patterns index ("fast" part)

For each factory
 | * offset of the dict
 | KSycocaEntries
 | | * entry type
 | | Entry
 | | | entry-dependent information
 | | ...
 | |
 | Dict
 | | * hashtable size
 | | Hash list
 | | | * list of values used to compute a hash key
 | | Hash table
 | | | * id (positive = entry offset)
 | | | * id (negative = - offset in duplicates list )
 | | | * 0 if no entry for that hash value
 | | Table of duplicates
 | | |  * entry offset, key
 | | |  * entry offset, key
 | 

Offer list
| * servicetype offset, service offset
| * servicetype offset, service offset
| * servicetype offset, service offset
| * servicetype offset, service offset
| * 0
This allows to quickly find services associated with a servicetype.
It does NOT reflect the user profile, which is stored in profilerc and
implemented in KServiceTypeProfile.

Mimetype patterns
| Fast patterns (fixed size)
| * Extension (padded to 4 chars), mimetype offset
| * Extension (padded to 4 chars), mimetype offset
| * Extension (padded to 4 chars), mimetype offset
| Other patterns (variable size)
| * Pattern (ex : *.*gf), mimetype offset
| * Pattern (ex : Makefile*), mimetype offset
| * ""

The first one is designed for a binary search, since entries have a fixed size
and are sorted by extension.
The second one (10% of the mimetypes usually) is for a linear search.