diff options
Diffstat (limited to 'common/entitystorage.cpp')
-rw-r--r-- | common/entitystorage.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/entitystorage.cpp b/common/entitystorage.cpp index 8a3391e..bcc3562 100644 --- a/common/entitystorage.cpp +++ b/common/entitystorage.cpp | |||
@@ -19,9 +19,9 @@ | |||
19 | 19 | ||
20 | #include "entitystorage.h" | 20 | #include "entitystorage.h" |
21 | 21 | ||
22 | static void scan(const Akonadi2::Storage::Transaction &transaction, const QByteArray &key, std::function<bool(const QByteArray &key, const Akonadi2::Entity &entity)> callback) | 22 | static void scan(const Akonadi2::Storage::Transaction &transaction, const QByteArray &key, std::function<bool(const QByteArray &key, const Akonadi2::Entity &entity)> callback, const QByteArray &bufferType) |
23 | { | 23 | { |
24 | transaction.openDatabase().scan(key, [=](const QByteArray &key, const QByteArray &value) -> bool { | 24 | transaction.openDatabase(bufferType + ".main").scan(key, [=](const QByteArray &key, const QByteArray &value) -> bool { |
25 | //Skip internals | 25 | //Skip internals |
26 | if (Akonadi2::Storage::isInternalKey(key)) { | 26 | if (Akonadi2::Storage::isInternalKey(key)) { |
27 | return true; | 27 | return true; |
@@ -58,17 +58,17 @@ void EntityStorageBase::readValue(const Akonadi2::Storage::Transaction &transact | |||
58 | auto domainObject = create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)); | 58 | auto domainObject = create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)); |
59 | resultCallback(domainObject); | 59 | resultCallback(domainObject); |
60 | return true; | 60 | return true; |
61 | }); | 61 | }, mBufferType); |
62 | } | 62 | } |
63 | 63 | ||
64 | static ResultSet fullScan(const Akonadi2::Storage::Transaction &transaction) | 64 | static ResultSet fullScan(const Akonadi2::Storage::Transaction &transaction, const QByteArray &bufferType) |
65 | { | 65 | { |
66 | //TODO use a result set with an iterator, to read values on demand | 66 | //TODO use a result set with an iterator, to read values on demand |
67 | QVector<QByteArray> keys; | 67 | QVector<QByteArray> keys; |
68 | scan(transaction, QByteArray(), [=, &keys](const QByteArray &key, const Akonadi2::Entity &) { | 68 | scan(transaction, QByteArray(), [=, &keys](const QByteArray &key, const Akonadi2::Entity &) { |
69 | keys << key; | 69 | keys << key; |
70 | return true; | 70 | return true; |
71 | }); | 71 | }, bufferType); |
72 | Trace() << "Full scan found " << keys.size() << " results"; | 72 | Trace() << "Full scan found " << keys.size() << " results"; |
73 | return ResultSet(keys); | 73 | return ResultSet(keys); |
74 | } | 74 | } |
@@ -99,7 +99,7 @@ ResultSet EntityStorageBase::getResultSet(const Akonadi2::Query &query, Akonadi2 | |||
99 | 99 | ||
100 | //We do a full scan if there were no indexes available to create the initial set. | 100 | //We do a full scan if there were no indexes available to create the initial set. |
101 | if (appliedFilters.isEmpty()) { | 101 | if (appliedFilters.isEmpty()) { |
102 | resultSet = fullScan(transaction); | 102 | resultSet = fullScan(transaction, mBufferType); |
103 | } | 103 | } |
104 | 104 | ||
105 | auto filter = [remainingFilters, query, baseRevision, topRevision](const Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr &domainObject) -> bool { | 105 | auto filter = [remainingFilters, query, baseRevision, topRevision](const Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr &domainObject) -> bool { |