summaryrefslogtreecommitdiffstats
path: root/tests/storagebenchmark.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-03-30 23:38:45 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-03-31 11:11:08 +0200
commit42f32ea5865c95028c577000e15e8a8631d16e74 (patch)
tree2d9e8a77ccccf088a8807f35f87e4264163d6cdd /tests/storagebenchmark.cpp
parent34851314d39307f22df01a4b711e6fd3c5618e23 (diff)
downloadsink-42f32ea5865c95028c577000e15e8a8631d16e74.tar.gz
sink-42f32ea5865c95028c577000e15e8a8631d16e74.zip
Storage: API cleanup/use QByteArray instead of std::string
Diffstat (limited to 'tests/storagebenchmark.cpp')
-rw-r--r--tests/storagebenchmark.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp
index 9cf9a71..0233466 100644
--- a/tests/storagebenchmark.cpp
+++ b/tests/storagebenchmark.cpp
@@ -15,7 +15,7 @@
15using namespace Calendar; 15using namespace Calendar;
16using namespace flatbuffers; 16using namespace flatbuffers;
17 17
18static std::string createEvent() 18static QByteArray createEvent()
19{ 19{
20 static const size_t attachmentSize = 1024*2; // 2KB 20 static const size_t attachmentSize = 1024*2; // 2KB
21 static uint8_t rawData[attachmentSize]; 21 static uint8_t rawData[attachmentSize];
@@ -33,7 +33,7 @@ static std::string createEvent()
33 memcpy((void*)Calendar::GetEvent(fbb.GetBufferPointer())->attachment()->Data(), rawData, attachmentSize); 33 memcpy((void*)Calendar::GetEvent(fbb.GetBufferPointer())->attachment()->Data(), rawData, attachmentSize);
34 } 34 }
35 35
36 return std::string(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); 36 return QByteArray::fromRawData(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize());
37} 37}
38 38
39// static void readEvent(const std::string &data) 39// static void readEvent(const std::string &data)
@@ -103,9 +103,9 @@ private Q_SLOTS:
103 store->startTransaction(); 103 store->startTransaction();
104 } 104 }
105 105
106 store->write(keyPrefix + std::to_string(i), event); 106 store->write(keyPrefix + QByteArray::number(i), event);
107 } else { 107 } else {
108 myfile << event; 108 myfile << event.toStdString();
109 } 109 }
110 } 110 }
111 111
@@ -122,7 +122,7 @@ private Q_SLOTS:
122 { 122 {
123 for (int i = 0; i < count; i++) { 123 for (int i = 0; i < count; i++) {
124 if (store) { 124 if (store) {
125 store->read(keyPrefix + std::to_string(i), [](std::string value) -> bool { return true; }); 125 store->scan(keyPrefix + QByteArray::number(i), [](const QByteArray &value) -> bool { return true; });
126 } 126 }
127 } 127 }
128 } 128 }