Mercurial > hg > svcore
comparison rdf/PluginRDFIndexer.h @ 461:2019d89ebcf9
* Some work on querying and cacheing plugin RDF from a central index
author | Chris Cannam |
---|---|
date | Fri, 17 Oct 2008 15:26:29 +0000 |
parents | ef14acd6d102 |
children | c9b055f84326 |
comparison
equal
deleted
inserted
replaced
460:93fb1ebff76b | 461:2019d89ebcf9 |
---|---|
16 #ifndef _PLUGIN_RDF_INDEXER_H_ | 16 #ifndef _PLUGIN_RDF_INDEXER_H_ |
17 #define _PLUGIN_RDF_INDEXER_H_ | 17 #define _PLUGIN_RDF_INDEXER_H_ |
18 | 18 |
19 #include <QString> | 19 #include <QString> |
20 #include <QStringList> | 20 #include <QStringList> |
21 #include <QMutex> | |
21 #include <map> | 22 #include <map> |
22 #include <set> | 23 #include <set> |
23 | 24 |
24 class FileSource; | 25 class FileSource; |
25 | 26 |
26 class PluginRDFIndexer | 27 class PluginRDFIndexer |
27 { | 28 { |
28 public: | 29 public: |
29 static PluginRDFIndexer *getInstance(); | 30 static PluginRDFIndexer *getInstance(); |
31 | |
32 /** | |
33 * Index all URLs obtained from index files defined in the current | |
34 * settings. This is not done automatically because it may incur | |
35 * significant processing and networking effort. It could be | |
36 * called from a background thread at startup, for example. | |
37 * | |
38 * Note that this class has a single mutex, so other functions | |
39 * will block if called from a different thread while this one is | |
40 * running. | |
41 */ | |
42 bool indexConfiguredURLs(); | |
30 | 43 |
31 bool indexURL(QString url); // in addition to "installed" URLs | 44 bool indexURL(QString url); // in addition to "installed" URLs |
32 | 45 |
33 QString getURIForPluginId(QString pluginId); | 46 QString getURIForPluginId(QString pluginId); |
34 QString getIdForPluginURI(QString uri); | 47 QString getIdForPluginURI(QString uri); |
39 | 52 |
40 ~PluginRDFIndexer(); | 53 ~PluginRDFIndexer(); |
41 | 54 |
42 protected: | 55 protected: |
43 PluginRDFIndexer(); | 56 PluginRDFIndexer(); |
57 QMutex m_mutex; | |
44 std::set<FileSource *> m_sources; | 58 std::set<FileSource *> m_sources; |
45 typedef std::map<QString, QString> StringMap; | 59 typedef std::map<QString, QString> StringMap; |
46 StringMap m_uriToIdMap; | 60 StringMap m_uriToIdMap; |
47 StringMap m_idToUriMap; | 61 StringMap m_idToUriMap; |
48 StringMap m_idToDescriptionMap; | 62 StringMap m_idToDescriptionMap; |
49 bool indexFile(QString path); | 63 bool indexFile(QString path); |
50 static PluginRDFIndexer *m_instance; | 64 static PluginRDFIndexer *m_instance; |
65 void expireCacheMaybe(QString); | |
51 }; | 66 }; |
52 | 67 |
53 #endif | 68 #endif |
54 | 69 |