summaryrefslogtreecommitdiffstats
path: root/common/messagequeue.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/messagequeue.h')
-rw-r--r--common/messagequeue.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/messagequeue.h b/common/messagequeue.h
index 8ea8d8b..b6c2614 100644
--- a/common/messagequeue.h
+++ b/common/messagequeue.h
@@ -1,6 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include <QObject> 3#include <QObject>
4#include <QByteArrayList>
4#include <string> 5#include <string>
5#include <functional> 6#include <functional>
6#include <QString> 7#include <QString>
@@ -25,7 +26,9 @@ public:
25 }; 26 };
26 27
27 MessageQueue(const QString &storageRoot, const QString &name); 28 MessageQueue(const QString &storageRoot, const QString &name);
29 ~MessageQueue();
28 30
31 void startTransaction();
29 void enqueue(void const *msg, size_t size); 32 void enqueue(void const *msg, size_t size);
30 void enqueue(const QByteArray &value); 33 void enqueue(const QByteArray &value);
31 //Dequeue a message. This will return a new message everytime called. 34 //Dequeue a message. This will return a new message everytime called.
@@ -35,11 +38,20 @@ public:
35 const std::function<void(const Error &error)> &errorHandler); 38 const std::function<void(const Error &error)> &errorHandler);
36 KAsync::Job<void> dequeueBatch(int maxBatchSize, const std::function<KAsync::Job<void>(const QByteArray &)> &resultHandler); 39 KAsync::Job<void> dequeueBatch(int maxBatchSize, const std::function<KAsync::Job<void>(const QByteArray &)> &resultHandler);
37 bool isEmpty(); 40 bool isEmpty();
41
42public slots:
43 void commit();
44
38signals: 45signals:
39 void messageReady(); 46 void messageReady();
40 void drained(); 47 void drained();
41 48
49private slots:
50 void processRemovals();
51
42private: 52private:
43 Q_DISABLE_COPY(MessageQueue); 53 Q_DISABLE_COPY(MessageQueue);
44 Akonadi2::Storage mStorage; 54 Akonadi2::Storage mStorage;
55 Akonadi2::Storage::Transaction mWriteTransaction;
56 QByteArrayList mPendingRemoval;
45}; 57};