From 48c0f01320981319a9ac0f34a7ce117325bfbc13 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 23 Jan 2018 17:03:25 +0100 Subject: Implemented removePrefix --- common/synchronizerstore.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common/synchronizerstore.cpp b/common/synchronizerstore.cpp index 79cd920..ee33018 100644 --- a/common/synchronizerstore.cpp +++ b/common/synchronizerstore.cpp @@ -130,9 +130,14 @@ void SynchronizerStore::removePrefix(const QByteArray &prefix) if (prefix.isEmpty()) { return; } - //FIXME remove all values matching prefix - // mTransaction.openDatabase("values").remove(prefix, [](const Sink::Storage::DataStore::Error &) { - // //Ignore errors because we may not find the value - // }); + auto db = mTransaction.openDatabase("values"); + QByteArrayList keys; + db.scan(prefix, [&] (const QByteArray &key, const QByteArray &value) { + keys << key; + return true; + }, {}, true, true); + for (const auto &k : keys) { + db.remove(k); + } } -- cgit v1.2.3