data: reducing database size by discarding indices

* added storage modes to facilitate adding and removing sqlite indices as needed.
This commit is contained in:
malte_langkabel
2016-11-04 14:29:20 +01:00
parent e7c9a1340e
commit 3f27c89965
9 changed files with 77 additions and 24 deletions
+14 -2
View File
@@ -13,6 +13,7 @@
#include "data/location/TokenLocationCollection.h"
#include "data/name/NameHierarchy.h"
#include "data/StorageTypes.h"
#include "data/SqliteIndex.h"
class TextAccess;
class Version;
@@ -21,12 +22,22 @@ struct ParseLocation;
class SqliteStorage
{
public:
enum StorageModeType
{
STORAGE_MODE_UNKNOWN = 0,
STORAGE_MODE_READ = 1,
STORAGE_MODE_WRITE = 2,
STORAGE_MODE_CLEAR = 4,
};
SqliteStorage(const FilePath& dbFilePath);
~SqliteStorage();
void setup();
void clear();
void setMode(const StorageModeType mode);
void beginTransaction();
void commitTransaction();
void rollbackTransaction();
@@ -105,8 +116,6 @@ public:
StorageComponentAccess getComponentAccessByNodeId(Id memberEdgeId) const;
std::vector<StorageComponentAccess> getComponentAccessesByNodeIds(const std::vector<Id>& memberEdgeIds) const;
std::vector<ParseLocation> getFullTextSearch(const std::string& searchTerm) const;
std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const;
std::vector<StorageFile> getAllFiles() const;
@@ -158,6 +167,9 @@ private:
mutable CppSQLite3DB m_database;
FilePath m_dbFilePath;
StorageModeType m_mode;
std::vector<std::pair<int, SqliteIndex>> m_indices;
};
template <>