summaryrefslogtreecommitdiffstats
path: root/common/messagequeue.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/messagequeue.h')
-rw-r--r--common/messagequeue.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/common/messagequeue.h b/common/messagequeue.h
index 9399055..6f0bddb 100644
--- a/common/messagequeue.h
+++ b/common/messagequeue.h
@@ -16,14 +16,16 @@ class SINK_EXPORT MessageQueue : public QObject
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 enum ErrorCodes { 19 enum ErrorCodes
20 {
20 NoMessageFound 21 NoMessageFound
21 }; 22 };
22 class Error 23 class Error
23 { 24 {
24 public: 25 public:
25 Error(const QByteArray &s, int c, const QByteArray &m) 26 Error(const QByteArray &s, int c, const QByteArray &m) : store(s), message(m), code(c)
26 : store(s), message(m), code(c) {} 27 {
28 }
27 QByteArray store; 29 QByteArray store;
28 QByteArray message; 30 QByteArray message;
29 int code; 31 int code;
@@ -35,11 +37,10 @@ public:
35 void startTransaction(); 37 void startTransaction();
36 void enqueue(void const *msg, size_t size); 38 void enqueue(void const *msg, size_t size);
37 void enqueue(const QByteArray &value); 39 void enqueue(const QByteArray &value);
38 //Dequeue a message. This will return a new message everytime called. 40 // Dequeue a message. This will return a new message everytime called.
39 //Call the result handler with a success response to remove the message from the store. 41 // Call the result handler with a success response to remove the message from the store.
40 //TODO track processing progress to avoid processing the same message with the same preprocessor twice? 42 // TODO track processing progress to avoid processing the same message with the same preprocessor twice?
41 void dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> & resultHandler, 43 void dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> &resultHandler, const std::function<void(const Error &error)> &errorHandler);
42 const std::function<void(const Error &error)> &errorHandler);
43 KAsync::Job<void> dequeueBatch(int maxBatchSize, const std::function<KAsync::Job<void>(const QByteArray &)> &resultHandler); 44 KAsync::Job<void> dequeueBatch(int maxBatchSize, const std::function<KAsync::Job<void>(const QByteArray &)> &resultHandler);
44 bool isEmpty(); 45 bool isEmpty();
45 46