diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 17:03:25 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-23 17:03:25 +0100 |
commit | 48c0f01320981319a9ac0f34a7ce117325bfbc13 (patch) | |
tree | 970bbcb7885158ae00c1d17293890b499c3db82e /common | |
parent | 5ef044eab02e1e8429a05b45398566ad81124fb6 (diff) | |
download | sink-48c0f01320981319a9ac0f34a7ce117325bfbc13.tar.gz sink-48c0f01320981319a9ac0f34a7ce117325bfbc13.zip |
Implemented removePrefix
Diffstat (limited to 'common')
-rw-r--r-- | common/synchronizerstore.cpp | 13 |
1 files 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) | |||
130 | if (prefix.isEmpty()) { | 130 | if (prefix.isEmpty()) { |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | //FIXME remove all values matching prefix | 133 | auto db = mTransaction.openDatabase("values"); |
134 | // mTransaction.openDatabase("values").remove(prefix, [](const Sink::Storage::DataStore::Error &) { | 134 | QByteArrayList keys; |
135 | // //Ignore errors because we may not find the value | 135 | db.scan(prefix, [&] (const QByteArray &key, const QByteArray &value) { |
136 | // }); | 136 | keys << key; |
137 | return true; | ||
138 | }, {}, true, true); | ||
139 | for (const auto &k : keys) { | ||
140 | db.remove(k); | ||
141 | } | ||
137 | } | 142 | } |
138 | 143 | ||