data: reducing database size by discarding indices
* added storage modes to facilitate adding and removing sqlite indices as needed.
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
#include "data/parser/TaskParseWrapper.h"
|
||||
|
||||
#include "component/view/DialogView.h"
|
||||
#include "data/PersistentStorage.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
TaskParseWrapper::TaskParseWrapper(
|
||||
PersistentStorage* storage,
|
||||
std::shared_ptr<FileRegister> fileRegister,
|
||||
DialogView* dialogView
|
||||
)
|
||||
: m_fileRegister(fileRegister)
|
||||
: m_storage(storage)
|
||||
, m_fileRegister(fileRegister)
|
||||
, m_dialogView(dialogView)
|
||||
{
|
||||
}
|
||||
@@ -29,9 +32,16 @@ void TaskParseWrapper::setTask(std::shared_ptr<Task> task)
|
||||
void TaskParseWrapper::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
blackboard->set("indexer_count", 0);
|
||||
m_dialogView->updateIndexingDialog(0, m_fileRegister->getSourceFilesCount(), "");
|
||||
|
||||
const size_t sourceFileCount = m_fileRegister->getSourceFilesCount();
|
||||
m_dialogView->updateIndexingDialog(0, sourceFileCount, "");
|
||||
|
||||
m_start = utility::durationStart();
|
||||
|
||||
if (sourceFileCount > 0)
|
||||
{
|
||||
m_storage->setMode(SqliteStorage::STORAGE_MODE_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
Task::TaskState TaskParseWrapper::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
|
||||
class DialogView;
|
||||
class FileRegister;
|
||||
class PersistentStorage;
|
||||
|
||||
class TaskParseWrapper
|
||||
: public TaskDecorator
|
||||
{
|
||||
public:
|
||||
TaskParseWrapper(
|
||||
PersistentStorage* storage,
|
||||
std::shared_ptr<FileRegister> fileRegister,
|
||||
DialogView* dialogView
|
||||
);
|
||||
@@ -31,6 +33,7 @@ private:
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
|
||||
|
||||
PersistentStorage* m_storage;
|
||||
std::shared_ptr<FileRegister> m_fileRegister;
|
||||
DialogView* m_dialogView;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user