m (KBuildSycoca (private class) -> KSycoca (exported class)) |
m (Development/Architecture/KDE 3 Architecture/System Configuration Cache moved to Development/Architecture/KDE3/System Configuration Cache) |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 88: | Line 88: | ||
== Users of the Sycoca database == | == Users of the Sycoca database == | ||
| − | ;KServiceTypeFactory (KSycocaFactory): | + | ;[http://api.kde.org/3.5-api/kdelibs-apidocs/kio/kio/html/classKServiceTypeFactory.html KServiceTypeFactory] (subclass of KSycocaFactory): |
* Offers KServiceType lookup on name. | * Offers KServiceType lookup on name. | ||
* Offers KMimeType lookup on name (name == mimetype). | * Offers KMimeType lookup on name (name == mimetype). | ||
| Line 96: | Line 96: | ||
* Offers KExecMimeType lookup (one instance only). | * Offers KExecMimeType lookup (one instance only). | ||
| − | ;KServiceFactory (KSycocaFactory): | + | ;[http://api.kde.org/3.5-api/kdelibs-apidocs/kio/kio/html/classKServiceFactory.html KServiceFactory] (subclass of KSycocaFactory): |
* Offers KService lookup on name. | * Offers KService lookup on name. | ||
| − | ;KProtocolInfoFactory (KSycocaFactory) | + | ;[http://api.kde.org/3.5-api/kdelibs-apidocs/kdecore/html/classKProtocolInfoFactory.html KProtocolInfoFactory] (subclass of KSycocaFactory) |
* Offers KProtocolInfo lookup on name (name == protocol). | * Offers KProtocolInfo lookup on name (name == protocol). | ||
| − | ;KImageIOFactory (KSycocaFactory) | + | ;[http://api.kde.org/3.5-api/kdelibs-apidocs/kio/kio/html/classKImageIOFactory.html KImageIOFactory] (subclass of KSycocaFactory) |
* Registers image-IO plugins and loads image-IO plugins when needed. | * Registers image-IO plugins and loads image-IO plugins when needed. | ||
| − | ;KServiceGroupFactory (KSycocaFactory) | + | ;[http://api.kde.org/3.5-api/kdelibs-apidocs/kio/kio/html/classKServiceGroupFactory.html KServiceGroupFactory] (subclass of KSycocaFactory) |
* Offers KServiceGroup lookup on path. | * Offers KServiceGroup lookup on path. | ||
| + | |||
KServiceTypeFactory is repsonsible for the following classes: | KServiceTypeFactory is repsonsible for the following classes: | ||
| − | * KServiceType (KSycocaEntry) | + | * KServiceType (subclass of KSycocaEntry) |
| − | * KMimeType (KServiceType) | + | * KMimeType (subclass of KServiceType) |
| − | * KFolderType (KMimeType) | + | * KFolderType (subclass of KMimeType) |
| − | * KDEDesktopMimeType(KMimeType) | + | * KDEDesktopMimeType (subclass of KMimeType) |
| − | * KExecMimeType (KMimeType) | + | * KExecMimeType (subclass of KMimeType) |
| + | |||
KServiceFactory is responsible for the following classes: | KServiceFactory is responsible for the following classes: | ||
| − | * | + | * KService (subclass of KSycocaEntry) |
| Line 125: | Line 127: | ||
''Initial Author:'' Waldo Bastian [mailto:bastian@kde.org bastian@kde.org] | ''Initial Author:'' Waldo Bastian [mailto:bastian@kde.org bastian@kde.org] | ||
| + | |||
| + | [[Category:KDE3]] | ||
| + | [[Category:Architecture]] | ||
Sycoca - KDE's System Configuration Cache
Contents |
Sycoca stands for System Configuration Cache and is nominated to be the successor of kregistry. It is a light weight database optimized for looking up static system configuration information fast and with minimal memory usage.
The database will offer read-only access to many clients at once. The database is read-only which means that looking up can be very fast since no locking or transaction operations need to be performed. The database is created/updated by kbuildsycoca from human readable configuration files. kded monitors these configuration files and will call kbuildsycoca to update the database when a change in any of the configuration files is detected.
Updating the database will mean that the database is replaced as a whole by a more up to date version. This approach allows a very straight forward database implementation. With Sycoca it will not be necessary any more to parse multiple files when looking for static system information. Instead Sycoca can return the requested information with a performance near to O(1). Examples of static system information are mimetype bindings and .desktop information (servicetypes). Application specific configuration information will _NOT_ be stored in Sycoca since this information is usually subject to regular change.
Applications never use sycoca directly but always through classes provided by the KDE framework. The following classes use sycoca to obtain their information:
KSycocaDict offers a fast lookup-index based on string keys. Creation of the index is reasonably slow, but once the index has been created information can be found with a small number of steps nearly independent from the data size.
During creation KSycocaDict creates a hash-function and a hash-index which is populated for approximately 20% and which has a typical hash collision chance of 10%.
This means that existing objects can be found at once in 90% of the time. In the other 10% the collision list has to be searched. A collision list typically contains 2 entries.
Not existing objects have a chance of 20% to give a false hit. A hit should therefore always be verified by loading the actual object.
KSycocaDict is used by the KSycocaFactories to be able to create fast lookup functions for the objects it maintains.
KServiceTypeFactory is repsonsible for the following classes:
KServiceFactory is responsible for the following classes:
Implementation notes:
Initial Author: Waldo Bastian bastian@kde.org