Akonadi

preprocessorinstance.h
1 /******************************************************************************
2  *
3  * File : preprocessorinstance.h
4  * Creation date : Sat 18 Jul 2009 02:50:39
5  *
6  * Copyright (c) 2009 Szymon Stefanek <s.stefanek at gmail dot com>
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Library General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA, 02110-1301, USA.
22  *
23  *****************************************************************************/
24 
25 #ifndef AKONADI_PREPROCESSORINSTANCE_H
26 #define AKONADI_PREPROCESSORINSTANCE_H
27 
28 #include <QObject>
29 #include <QDateTime>
30 
31 #include <deque>
32 
33 class OrgFreedesktopAkonadiPreprocessorInterface;
34 
35 namespace Akonadi
36 {
37 namespace Server
38 {
39 
40 class PreprocessorManager;
41 class AgentInstance;
42 class Tracer;
43 
54 {
55  friend class PreprocessorManager;
56 
57  Q_OBJECT
58 
59 protected:
60 
64  PreprocessorInstance(const QString &id, PreprocessorManager &manager, Tracer &tracer);
65 
66 public: // This is public only for qDeleteAll() called from PreprocessorManager
67  // ...for some reason couldn't convince gcc to have it as friend...
68 
73 
74 private:
75  PreprocessorManager &mManager;
76  Tracer &mTracer;
77 
83  std::deque< qint64 > mItemQueue;
84 
90  bool mBusy = false;
91 
98  QDateTime mItemProcessingStartDateTime;
99 
104  QString mId;
105 
109  OrgFreedesktopAkonadiPreprocessorInterface *mInterface = nullptr;
110 
111 protected:
112 
119  bool init();
120 
126  bool isBusy() const
127  {
128  return mBusy;
129  }
130 
136  qint64 currentProcessingTime();
137 
142  const QString &id() const
143  {
144  return mId;
145  }
146 
156  std::deque< qint64 > *itemQueue()
157  {
158  return &mItemQueue;
159  }
160 
165  void enqueueItem(qint64 itemId);
166 
175  bool abortProcessing();
176 
182  bool invokeRestart();
183 
184 private:
185 
190  void processHeadItem();
191 
192 private Q_SLOTS:
193 
198  void itemProcessed(qlonglong id);
199 
200 }; // class PreprocessorInstance
201 
202 } // namespace Server
203 } // namespace Akonadi
204 
205 #endif
bool init()
This is called by PreprocessorManager just after the construction in order to connect to the preproce...
bool invokeRestart()
Attempts to invoke the preprocessor slave restart via AgentManager.
The global tracer instance where all akonadi components can send their tracing information to...
Definition: tracer.h:53
PreprocessorInstance(const QString &id, PreprocessorManager &manager, Tracer &tracer)
Create an instance of a PreprocessorInstance descriptor.
std::deque< qint64 > * itemQueue()
Returns a pointer to the internal preprocessor instance item queue.
Represents one agent instance and takes care of communication with it.
The manager for preprocessor agents.
Q_OBJECTQ_OBJECT
A single preprocessor (agent) instance.
bool abortProcessing()
Attempts to abort the processing of the current item.
bool isBusy() const
Returns true if this preprocessor instance is currently processing an item.
~PreprocessorInstance()
Destroy this instance of the PreprocessorInstance descriptor.
Helper integration between Akonadi and Qt.
void enqueueItem(qint64 itemId)
This is called by PreprocessorManager to enqueue a PimItem for processing by this preprocessor instan...
qint64 currentProcessingTime()
Returns the time in seconds elapsed since the current item was submitted to the slave preprocessor in...
Q_SLOTSQ_SLOTS
const QString & id() const
Returns the id of this preprocessor.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.