data: indexer processes

* TaskBuildIndex starts seperate indexer processes and communicates via shared memory
* indexer processes get restarted if they fail
* indexer processes are killed when the app closes or crashes
* added utility class SharedMemory to allocate and access shared memory, providing basic data structures
* added SharedMemoryGarbageCollector for keeping track of running instances and cleaning up shared memory in case of a crash
* show errors for source files that crashed during indexing
* added basic exception handling to task scheduling
* added option to turn off processes and use threads in preferences, but still use shared memory

fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
Eberhard Graether
2017-05-04 15:50:59 +02:00
parent 9beea94fd8
commit 706119ebcc
109 changed files with 3351 additions and 1261 deletions
+18 -1
View File
@@ -4,6 +4,7 @@
#include "data/PersistentStorage.h"
#include "utility/file/FileRegister.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/scheduling/Blackboard.h"
#include "utility/utility.h"
#include "Application.h"
@@ -63,6 +64,9 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
int sourceFileCount = 0;
blackboard->get("source_file_count", sourceFileCount);
bool interruptedIndexing = false;
blackboard->get("interrupted_indexing", interruptedIndexing);
StorageStats stats = m_storageAccess->getStorageStats();
dialogView->finishedIndexingDialog(
indexedSourceFileCount,
@@ -70,7 +74,8 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
stats.completedFileCount,
stats.fileCount,
time,
m_storageAccess->getErrorCount()
m_storageAccess->getErrorCount(),
interruptedIndexing
);
return STATE_SUCCESS;
@@ -83,3 +88,15 @@ void TaskFinishParsing::doExit(std::shared_ptr<Blackboard> blackboard)
void TaskFinishParsing::doReset(std::shared_ptr<Blackboard> blackboard)
{
}
void TaskFinishParsing::terminate()
{
Application* app = Application::getInstance().get();
if (app)
{
app->getDialogView()->hideDialogs();
}
MessageStatus("An unknown exception was thrown during indexing.", true, false).dispatch();
MessageFinishedParsing().dispatch();
}