diff options
Diffstat (limited to 'tests/storagebenchmark.cpp')
-rw-r--r-- | tests/storagebenchmark.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp index a1ddcc9..906844e 100644 --- a/tests/storagebenchmark.cpp +++ b/tests/storagebenchmark.cpp | |||
@@ -62,7 +62,7 @@ private slots: | |||
62 | 62 | ||
63 | void cleanupTestCase() | 63 | void cleanupTestCase() |
64 | { | 64 | { |
65 | Sink::Storage store(testDataPath, dbName); | 65 | Sink::Storage::DataStore store(testDataPath, dbName); |
66 | store.removeFromDisk(); | 66 | store.removeFromDisk(); |
67 | } | 67 | } |
68 | 68 | ||
@@ -70,7 +70,7 @@ private slots: | |||
70 | { | 70 | { |
71 | auto event = createEvent(); | 71 | auto event = createEvent(); |
72 | 72 | ||
73 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadWrite)); | 73 | QScopedPointer<Sink::Storage::DataStore> store(new Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadWrite)); |
74 | 74 | ||
75 | const char *keyPrefix = "key"; | 75 | const char *keyPrefix = "key"; |
76 | 76 | ||
@@ -78,12 +78,12 @@ private slots: | |||
78 | time.start(); | 78 | time.start(); |
79 | // Test db write time | 79 | // Test db write time |
80 | { | 80 | { |
81 | auto transaction = store->createTransaction(Sink::Storage::ReadWrite); | 81 | auto transaction = store->createTransaction(Sink::Storage::DataStore::ReadWrite); |
82 | for (int i = 0; i < count; i++) { | 82 | for (int i = 0; i < count; i++) { |
83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); | 83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); |
84 | if ((i % 10000) == 0) { | 84 | if ((i % 10000) == 0) { |
85 | transaction.commit(); | 85 | transaction.commit(); |
86 | transaction = store->createTransaction(Sink::Storage::ReadWrite); | 86 | transaction = store->createTransaction(Sink::Storage::DataStore::ReadWrite); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | transaction.commit(); | 89 | transaction.commit(); |
@@ -105,7 +105,7 @@ private slots: | |||
105 | 105 | ||
106 | // Db read time | 106 | // Db read time |
107 | { | 107 | { |
108 | auto transaction = store->createTransaction(Sink::Storage::ReadOnly); | 108 | auto transaction = store->createTransaction(Sink::Storage::DataStore::ReadOnly); |
109 | auto db = transaction.openDatabase(); | 109 | auto db = transaction.openDatabase(); |
110 | for (int i = 0; i < count; i++) { | 110 | for (int i = 0; i < count; i++) { |
111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); | 111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); |
@@ -126,7 +126,7 @@ private slots: | |||
126 | 126 | ||
127 | void testSizes() | 127 | void testSizes() |
128 | { | 128 | { |
129 | Sink::Storage store(testDataPath, dbName); | 129 | Sink::Storage::DataStore store(testDataPath, dbName); |
130 | qDebug() << "Database size [kb]: " << store.diskUsage() / 1024; | 130 | qDebug() << "Database size [kb]: " << store.diskUsage() / 1024; |
131 | 131 | ||
132 | QFileInfo fileInfo(filePath); | 132 | QFileInfo fileInfo(filePath); |
@@ -135,11 +135,11 @@ private slots: | |||
135 | 135 | ||
136 | void testScan() | 136 | void testScan() |
137 | { | 137 | { |
138 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); | 138 | QScopedPointer<Sink::Storage::DataStore> store(new Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly)); |
139 | 139 | ||
140 | QBENCHMARK { | 140 | QBENCHMARK { |
141 | int hit = 0; | 141 | int hit = 0; |
142 | store->createTransaction(Sink::Storage::ReadOnly) | 142 | store->createTransaction(Sink::Storage::DataStore::ReadOnly) |
143 | .openDatabase() | 143 | .openDatabase() |
144 | .scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { | 144 | .scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { |
145 | if (key == "key10000") { | 145 | if (key == "key10000") { |
@@ -154,8 +154,8 @@ private slots: | |||
154 | 154 | ||
155 | void testKeyLookup() | 155 | void testKeyLookup() |
156 | { | 156 | { |
157 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); | 157 | QScopedPointer<Sink::Storage::DataStore> store(new Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly)); |
158 | auto transaction = store->createTransaction(Sink::Storage::ReadOnly); | 158 | auto transaction = store->createTransaction(Sink::Storage::DataStore::ReadOnly); |
159 | auto db = transaction.openDatabase(); | 159 | auto db = transaction.openDatabase(); |
160 | 160 | ||
161 | QBENCHMARK { | 161 | QBENCHMARK { |
@@ -170,8 +170,8 @@ private slots: | |||
170 | 170 | ||
171 | void testFindLatest() | 171 | void testFindLatest() |
172 | { | 172 | { |
173 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); | 173 | QScopedPointer<Sink::Storage::DataStore> store(new Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly)); |
174 | auto transaction = store->createTransaction(Sink::Storage::ReadOnly); | 174 | auto transaction = store->createTransaction(Sink::Storage::DataStore::ReadOnly); |
175 | auto db = transaction.openDatabase(); | 175 | auto db = transaction.openDatabase(); |
176 | 176 | ||
177 | QBENCHMARK { | 177 | QBENCHMARK { |