diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-22 11:25:26 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-22 11:25:26 +0200 |
commit | 6746247a49f09287ae4924c5c3df791f9bf61cbc (patch) | |
tree | b9df15f1e6413a8995704cf9f0c5f425c9bb9558 /tests/storagebenchmark.cpp | |
parent | fc3a5df884b25d5e624027b1fb017f42986980b2 (diff) | |
download | sink-6746247a49f09287ae4924c5c3df791f9bf61cbc.tar.gz sink-6746247a49f09287ae4924c5c3df791f9bf61cbc.zip |
Use named databases in storage.
This will allow us to create indexes in the same store.
Diffstat (limited to 'tests/storagebenchmark.cpp')
-rw-r--r-- | tests/storagebenchmark.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp index ce1005d..f143c4d 100644 --- a/tests/storagebenchmark.cpp +++ b/tests/storagebenchmark.cpp | |||
@@ -97,9 +97,12 @@ private Q_SLOTS: | |||
97 | auto event = createEvent(); | 97 | auto event = createEvent(); |
98 | if (store) { | 98 | if (store) { |
99 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | 99 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); |
100 | transaction.setAutocommit(10000); | ||
101 | for (int i = 0; i < count; i++) { | 100 | for (int i = 0; i < count; i++) { |
102 | transaction.write(keyPrefix + QByteArray::number(i), event); | 101 | transaction.write(keyPrefix + QByteArray::number(i), event); |
102 | if ((i % 10000) == 0) { | ||
103 | transaction.commit(); | ||
104 | transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | ||
105 | } | ||
103 | } | 106 | } |
104 | transaction.commit(); | 107 | transaction.commit(); |
105 | } else { | 108 | } else { |
@@ -116,8 +119,9 @@ private Q_SLOTS: | |||
116 | { | 119 | { |
117 | if (store) { | 120 | if (store) { |
118 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly); | 121 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly); |
122 | auto db = transaction.openDatabase(); | ||
119 | for (int i = 0; i < count; i++) { | 123 | for (int i = 0; i < count; i++) { |
120 | transaction.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); | 124 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); |
121 | } | 125 | } |
122 | } | 126 | } |
123 | } | 127 | } |