From 63b056d69f3063a8a564b38c1890ae65afaddc2c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 12 Feb 2016 11:45:24 +0100 Subject: Sequential keys go badly with findLatest --- common/storage.h | 6 ++++++ tests/databasepopulationandfacadequerybenchmark.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/storage.h b/common/storage.h index ac03947..663d192 100644 --- a/common/storage.h +++ b/common/storage.h @@ -86,6 +86,12 @@ public: const std::function &resultHandler, const std::function &errorHandler = std::function(), bool findSubstringKeys = false) const; + /** + * Finds the last value in a series matched by prefix. + * + * This is used to match by uid prefix and find the highest revision. + * Note that this relies on a key scheme like $uid$revision. + */ void findLatest(const QByteArray &uid, const std::function &resultHandler, const std::function &errorHandler = std::function()) const; diff --git a/tests/databasepopulationandfacadequerybenchmark.cpp b/tests/databasepopulationandfacadequerybenchmark.cpp index 63daebc..7df38ba 100644 --- a/tests/databasepopulationandfacadequerybenchmark.cpp +++ b/tests/databasepopulationandfacadequerybenchmark.cpp @@ -58,7 +58,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject flatbuffers::FlatBufferBuilder fbb; domainTypeAdaptorFactory->createBuffer(*domainObject, fbb); const auto buffer = QByteArray::fromRawData(reinterpret_cast(fbb.GetBufferPointer()), fbb.GetSize()); - const auto key = QString::number(i).toLatin1(); + const auto key = QUuid::createUuid().toString().toLatin1(); db.write(key, buffer); bufferSizeTotal += buffer.size(); keysSizeTotal += key.size(); -- cgit v1.2.3