logic: improved indexer parallelization
* added task that injects into PersistentStorage parallel to indexer tasks. * added Blackboard for Task classes
This commit is contained in:
@@ -1,30 +1,50 @@
|
||||
#include "data/TaskInjectStorage.h"
|
||||
|
||||
#include "data/Storage.h"
|
||||
#include "data/StorageProvider.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
|
||||
TaskInjectStorage::TaskInjectStorage(
|
||||
std::shared_ptr<Storage> source,
|
||||
std::shared_ptr<StorageProvider> storageProvider,
|
||||
std::shared_ptr<Storage> target
|
||||
)
|
||||
: m_source(source)
|
||||
: m_storageProvider(storageProvider)
|
||||
, m_target(target)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskInjectStorage::doEnter()
|
||||
void TaskInjectStorage::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
Task::TaskState TaskInjectStorage::doUpdate()
|
||||
Task::TaskState TaskInjectStorage::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
m_target->inject(m_source.get());
|
||||
return STATE_SUCCESS;
|
||||
if (m_storageProvider->getStorageCount() > 0)
|
||||
{
|
||||
std::shared_ptr<IntermediateStorage> source = m_storageProvider->popInjectionSource();
|
||||
if (source)
|
||||
{
|
||||
m_target->inject(source.get());
|
||||
return STATE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
int indexerCount = 0;
|
||||
if (blackboard->get("indexer_count", indexerCount))
|
||||
{
|
||||
if (indexerCount > 0)
|
||||
{
|
||||
return STATE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return STATE_FAILURE;
|
||||
}
|
||||
|
||||
void TaskInjectStorage::doExit()
|
||||
void TaskInjectStorage::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskInjectStorage::doReset()
|
||||
void TaskInjectStorage::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user