data: reduced size of generated .coatidb files

* added occurrence table to get rid of duplicate source locations
* reverted storage provider
This commit is contained in:
malte_langkabel
2016-11-04 08:43:10 +01:00
parent 98869e51a5
commit e7c9a1340e
11 changed files with 394 additions and 159 deletions
+30 -4
View File
@@ -1,7 +1,5 @@
#include "data/StorageProvider.h"
#include <iostream>
int StorageProvider::getStorageCount() const
{
std::lock_guard<std::mutex> lock(m_storagesMutex);
@@ -10,13 +8,38 @@ int StorageProvider::getStorageCount() const
void StorageProvider::pushIndexerTarget(std::shared_ptr<IntermediateStorage> storage)
{
const std::size_t storageSize = storage->getSourceLocationCount();
std::list<std::shared_ptr<IntermediateStorage>>::iterator it;
std::lock_guard<std::mutex> lock(m_storagesMutex);
m_storages.push_back(storage);
for (it = m_storages.begin(); it != m_storages.end(); it++)
{
if ((*it)->getSourceLocationCount() < storageSize)
{
break;
}
}
m_storages.insert(it, storage);
}
std::shared_ptr<IntermediateStorage> StorageProvider::popIndexerTarget()
{
return std::make_shared<IntermediateStorage>();;
std::shared_ptr<IntermediateStorage> ret;
{
std::lock_guard<std::mutex> lock(m_storagesMutex);
if (m_storages.size() > 1)
{
std::list<std::shared_ptr<IntermediateStorage>>::iterator it = m_storages.begin();
it++;
ret = *it;
m_storages.erase(it);
}
else
{
ret = std::make_shared<IntermediateStorage>();
}
}
return ret;
}
std::shared_ptr<IntermediateStorage> StorageProvider::popInjectionSource()
@@ -33,3 +56,6 @@ std::shared_ptr<IntermediateStorage> StorageProvider::popInjectionSource()
return ret;
}