Akonadi

preprocessormanager.h
1 /******************************************************************************
2  *
3  * File : preprocessormanager.h
4  * Creation date : Sat 18 Jul 2009 01:58:50
5  *
6  * SPDX-FileCopyrightText: 2009 Szymon Stefanek <s.stefanek at gmail dot com>
7  *
8  * SPDX-License-Identifier: LGPL-2.0-or-later
9  *
10  *****************************************************************************/
11 
12 #ifndef AKONADI_PREPROCESSORMANAGER_H
13 #define AKONADI_PREPROCESSORMANAGER_H
14 
15 #include <QObject>
16 #include <QList>
17 #include <QHash>
18 #include <QMutex>
19 
20 #include <deque>
21 
22 class QTimer;
23 
24 #include "preprocessorinstance.h"
25 
26 namespace Akonadi
27 {
28 namespace Server
29 {
30 
31 class PimItem;
32 class DataStore;
33 class Tracer;
34 
60 {
61  friend class PreprocessorInstance;
62 
63  Q_OBJECT
64  Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Akonadi.PreprocessorManager")
65 
66 protected:
72 
81 
87  bool mEnabled = false;
88 
94 
98  QTimer *mHeartbeatTimer = nullptr;
99 
100 
101  Tracer &mTracer;
102 public:
106  explicit PreprocessorManager(Tracer &tracer);
107 
113 
122  bool isActive();
123 
133  bool isEnabled() const
134  {
135  return mEnabled;
136  }
137 
149  void setEnabled(bool enabled)
150  {
151  mEnabled = enabled;
152  }
153 
170  void beginHandleItem(const PimItem &item, const DataStore *dataStore);
171 
177  void registerInstance(const QString &id);
178 
184  void unregisterInstance(const QString &id);
185 
186 protected:
187 
194  void preProcessorFinishedHandlingItem(PreprocessorInstance *preProcessor, qint64 itemId);
195 
196 private:
197 
203  PreprocessorInstance *lockedFindInstance(const QString &id);
204 
209  void lockedActivateFirstPreprocessor(qint64 itemId);
210 
218  void lockedEndHandleItem(qint64 itemId);
219 
223  void lockedUnregisterInstance(const QString &id);
224 
228  void lockedKillWaitQueue(const DataStore *dataStore, bool disconnectSlots);
229 
230 private Q_SLOTS:
231 
236  void heartbeat();
237 
243  void dataStoreDestroyed();
244 
250  void dataStoreTransactionCommitted();
251 
257  void dataStoreTransactionRolledBack();
258 
259 }; // class PreprocessorManager
260 
261 } // namespace Server
262 } // namespace Akonadi
263 
264 #endif
Q_CLASSINFO(Name, Value)
void unregisterInstance(const QString &id)
This is called via D-Bus from AgentManager to unregister a preprocessor instance. ...
bool isEnabled() const
Returns true if this preprocessor hasn&#39;t been explicitly disabled via setEnabled( false )...
void preProcessorFinishedHandlingItem(PreprocessorInstance *preProcessor, qint64 itemId)
This is called by PreprocessorInstance to signal that a certain preprocessor has finished handling an...
void setEnabled(bool enabled)
Explicitly enables or disables the preprocessing in this Akonadi server.
QHash< const DataStore *, std::deque< qint64 > * > mTransactionWaitQueueHash
The hashtable of transaction wait queues.
The global tracer instance where all akonadi components can send their tracing information to...
Definition: tracer.h:40
void beginHandleItem(const PimItem &item, const DataStore *dataStore)
Trigger the preprocessor chain for the specified item.
PreprocessorManager(Tracer &tracer)
Creates an instance of PreprocessorManager.
bool isActive()
Returns true if preprocessing is active in this Akonadi server.
void registerInstance(const QString &id)
This is called via D-Bus from AgentManager to register a preprocessor instance.
The manager for preprocessor agents.
Q_OBJECTQ_OBJECT
A single preprocessor (agent) instance.
~PreprocessorManager()
Destroys the instance of PreprocessorManager and frees all the relevant resources.
Helper integration between Akonadi and Qt.
QMutex mMutex
The mutex used to protect the internals of this class (mainly the mPreprocessorChain member)...
QList< PreprocessorInstance * > mPreprocessorChain
The preprocessor chain.
QTimer * mHeartbeatTimer
The heartbeat timer.
This class handles all the database access.
Definition: datastore.h:95
Q_SLOTSQ_SLOTS
bool mEnabled
Is preprocessing enabled at all in this Akonadi server instance? This is true by default and can be s...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 12 2020 23:16:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.