Changeset View
Changeset View
Standalone View
Standalone View
src/server/storage/itemretrievalmanager.h
Show All 26 Lines | |||||
27 | #include <QHash> | 27 | #include <QHash> | ||
28 | #include <QObject> | 28 | #include <QObject> | ||
29 | #include <QReadWriteLock> | 29 | #include <QReadWriteLock> | ||
30 | #include <QWaitCondition> | 30 | #include <QWaitCondition> | ||
31 | 31 | | |||
32 | #include <unordered_map> | 32 | #include <unordered_map> | ||
33 | 33 | | |||
34 | class OrgFreedesktopAkonadiResourceInterface; | 34 | class OrgFreedesktopAkonadiResourceInterface; | ||
35 | class QDBusServiceWatcher; | ||||
35 | 36 | | |||
36 | namespace Akonadi | 37 | namespace Akonadi | ||
37 | { | 38 | { | ||
38 | namespace Server | 39 | namespace Server | ||
39 | { | 40 | { | ||
40 | 41 | | |||
41 | class Collection; | 42 | class Collection; | ||
42 | class ItemRetrievalJob; | 43 | class ItemRetrievalJob; | ||
Show All 31 Lines | 73 | Q_SIGNALS: | |||
74 | void requestAdded(); | 75 | void requestAdded(); | ||
75 | 76 | | |||
76 | private: | 77 | private: | ||
77 | OrgFreedesktopAkonadiResourceInterface *resourceInterface(const QString &id); | 78 | OrgFreedesktopAkonadiResourceInterface *resourceInterface(const QString &id); | ||
78 | 79 | | |||
79 | private Q_SLOTS: | 80 | private Q_SLOTS: | ||
80 | void init() override; | 81 | void init() override; | ||
81 | 82 | | |||
82 | void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner); | | |||
83 | void processRequest(); | 83 | void processRequest(); | ||
84 | void triggerCollectionSync(const QString &resource, qint64 colId); | 84 | void triggerCollectionSync(const QString &resource, qint64 colId); | ||
85 | void triggerCollectionTreeSync(const QString &resource); | 85 | void triggerCollectionTreeSync(const QString &resource); | ||
86 | void retrievalJobFinished(ItemRetrievalRequest *request, const QString &errorMsg); | 86 | void retrievalJobFinished(ItemRetrievalRequest *request, const QString &errorMsg); | ||
87 | 87 | | |||
88 | protected: | 88 | protected: | ||
89 | static ItemRetrievalManager *sInstance; | 89 | static ItemRetrievalManager *sInstance; | ||
90 | 90 | | |||
91 | std::unique_ptr<AbstractItemRetrievalJobFactory> mJobFactory; | 91 | std::unique_ptr<AbstractItemRetrievalJobFactory> mJobFactory; | ||
92 | 92 | | |||
93 | /// Protects mPendingRequests and every Request object posted to it | 93 | /// Protects mPendingRequests and every Request object posted to it | ||
94 | QReadWriteLock mLock; | 94 | QReadWriteLock mLock; | ||
95 | /// Used to let requesting threads wait until the request has been processed | 95 | /// Used to let requesting threads wait until the request has been processed | ||
96 | QWaitCondition mWaitCondition; | 96 | QWaitCondition mWaitCondition; | ||
97 | /// Pending requests queues, one per resource | 97 | /// Pending requests queues, one per resource | ||
98 | QHash<QString, QList<ItemRetrievalRequest *> > mPendingRequests; | 98 | QHash<QString, QList<ItemRetrievalRequest *> > mPendingRequests; | ||
99 | /// Currently running jobs, one per resource | 99 | /// Currently running jobs, one per resource | ||
100 | QHash<QString, AbstractItemRetrievalJob *> mCurrentJobs; | 100 | QHash<QString, AbstractItemRetrievalJob *> mCurrentJobs; | ||
101 | 101 | | |||
102 | // resource dbus interface cache | 102 | // resource dbus interface cache | ||
103 | std::unordered_map<QString, std::unique_ptr<OrgFreedesktopAkonadiResourceInterface>> mResourceInterfaces; | 103 | std::unordered_map<QString, std::unique_ptr<OrgFreedesktopAkonadiResourceInterface>> mResourceInterfaces; | ||
104 | std::unique_ptr<QDBusServiceWatcher> mDBusWatcher; | ||||
104 | }; | 105 | }; | ||
105 | 106 | | |||
106 | } // namespace Server | 107 | } // namespace Server | ||
107 | } // namespace Akonadi | 108 | } // namespace Akonadi | ||
108 | 109 | | |||
109 | #endif | 110 | #endif |