summaryrefslogtreecommitdiffstats
path: root/common/pipeline.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-23 18:56:43 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-23 18:56:43 +0200
commit1acf9f3c486813df807ff6931e56cc13eb26eeaf (patch)
tree559ead2e95986515b4a5f93b6f143b8f1d429bd3 /common/pipeline.cpp
parent62e7084dcd6f53275fcb21ba17e880e41b40094d (diff)
downloadsink-1acf9f3c486813df807ff6931e56cc13eb26eeaf.tar.gz
sink-1acf9f3c486813df807ff6931e56cc13eb26eeaf.zip
Store indexes as named databases in the same db.
Because we also keep using the same transactions this finally makes the resource somewhat performant. On my system genericresourcebenchmark now processes ~4200 messages per second instead of ~280.
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r--common/pipeline.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index ce4ad41..c5e36ee 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -441,18 +441,8 @@ void PipelineState::step()
441 d->idle = false; 441 d->idle = false;
442 if (d->filterIt.hasNext()) { 442 if (d->filterIt.hasNext()) {
443 //TODO skip step if already processed 443 //TODO skip step if already processed
444 //FIXME error handling if no result is found
445 auto preprocessor = d->filterIt.next(); 444 auto preprocessor = d->filterIt.next();
446 //FIXME this read should not be necessary 445 preprocessor->process(*this, d->pipeline->transaction());
447 //Perhaps simply use entity that is initially stored and synchronously process all filters. (Making the first filter somewhat redundant)
448 d->pipeline->transaction().scan(d->key, [this, preprocessor](const QByteArray &key, const QByteArray &value) -> bool {
449 auto entity = Akonadi2::GetEntity(value);
450 preprocessor->process(*this, *entity);
451 return false;
452 }, [this](const Akonadi2::Storage::Error &error) {
453 ErrorMsg() << "Failed to find value in pipeline: " << error.message;
454 d->pipeline->pipelineCompleted(*this);
455 });
456 } else { 446 } else {
457 //This object becomes invalid after this call 447 //This object becomes invalid after this call
458 d->pipeline->pipelineCompleted(*this); 448 d->pipeline->pipelineCompleted(*this);
@@ -483,7 +473,7 @@ Preprocessor::~Preprocessor()
483{ 473{
484} 474}
485 475
486void Preprocessor::process(const PipelineState &state, const Akonadi2::Entity &) 476void Preprocessor::process(const PipelineState &state, Akonadi2::Storage::Transaction &transaction)
487{ 477{
488 processingCompleted(state); 478 processingCompleted(state);
489} 479}