From 129333371d28c06d85f75ca579ce17798e615e84 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 28 Oct 2015 16:39:16 +0100 Subject: Made pipeline preprocessing synchronous. Instead of having the asynchronous preprocessor concept with different pipelines for new/modify/delete we have a single pipeline with synchronous preprocessors that act upon new/modify/delete. This keeps the code simpler due to lack of asynchronity and keeps the new/modify/delete operations together (which at least for the indexing makes a lot of sense). Not supporting asynchronity is ok because the tasks done in preprocessing are not cpu intensive (if they were we had a problem since they are directly involved in the round-trip time), and the main cost comes from i/o, meaning we don't gain much by doing multithreading. Costly tasks (such as full-text indexing) should rather be implemented as post-processing, since that doesn't increase the round-trip time directly, and eventually consistent is typically good enough for that. --- common/domain/event.cpp | 6 +++--- common/domain/event.h | 2 +- common/domain/mail.cpp | 7 +++---- common/domain/mail.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'common/domain') diff --git a/common/domain/event.cpp b/common/domain/event.cpp index 9759fc3..83a6906 100644 --- a/common/domain/event.cpp +++ b/common/domain/event.cpp @@ -50,11 +50,11 @@ ResultSet TypeImplementation::queryIndexes(const Akonadi2::Query &query, return ResultSet(keys); } -void TypeImplementation::index(const Event &type, Akonadi2::Storage::Transaction &transaction) +void TypeImplementation::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) { - const auto uid = type.getProperty("uid"); + const auto uid = bufferAdaptor.getProperty("uid"); if (uid.isValid()) { - Index("event.index.uid", transaction).add(uid.toByteArray(), type.identifier()); + Index("event.index.uid", transaction).add(uid.toByteArray(), identifier); } } diff --git a/common/domain/event.h b/common/domain/event.h index f21cd34..e9ba52a 100644 --- a/common/domain/event.h +++ b/common/domain/event.h @@ -56,7 +56,7 @@ public: * An empty result set indicates that a full scan is required. */ static ResultSet queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet &appliedFilters, Akonadi2::Storage::Transaction &transaction); - static void index(const Event &type, Akonadi2::Storage::Transaction &transaction); + static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); static QSharedPointer > initializeReadPropertyMapper(); static QSharedPointer > initializeWritePropertyMapper(); }; diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index d40dde9..ffe322e 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp @@ -50,12 +50,11 @@ ResultSet TypeImplementation::queryIndexes(const Akonadi2::Query &query, c return ResultSet(keys); } -void TypeImplementation::index(const Mail &type, Akonadi2::Storage::Transaction &transaction) +void TypeImplementation::index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction) { - const auto uid = type.getProperty("uid"); + const auto uid = bufferAdaptor.getProperty("uid"); if (uid.isValid()) { - Index uidIndex("mail.index.uid", transaction); - uidIndex.add(uid.toByteArray(), type.identifier()); + Index("mail.index.uid", transaction).add(uid.toByteArray(), identifier); } } diff --git a/common/domain/mail.h b/common/domain/mail.h index b58ce44..38f1d03 100644 --- a/common/domain/mail.h +++ b/common/domain/mail.h @@ -51,7 +51,7 @@ public: * An empty result set indicates that a full scan is required. */ static ResultSet queryIndexes(const Akonadi2::Query &query, const QByteArray &resourceInstanceIdentifier, QSet &appliedFilters, Akonadi2::Storage::Transaction &transaction); - static void index(const Mail &type, Akonadi2::Storage::Transaction &transaction); + static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Akonadi2::Storage::Transaction &transaction); static QSharedPointer > initializeReadPropertyMapper(); static QSharedPointer > initializeWritePropertyMapper(); }; -- cgit v1.2.3