diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-07 02:34:10 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-07 02:34:10 +0200 |
commit | a98311fbc807b83ecfc65a17f98464e5f1f9b3f8 (patch) | |
tree | a0c954404535fa832f7ddbd4f455fc67fe69bf4e /common/storage_common.cpp | |
parent | 32c507fa0565547a187632db8a80c07babb95d9d (diff) | |
download | sink-a98311fbc807b83ecfc65a17f98464e5f1f9b3f8.tar.gz sink-a98311fbc807b83ecfc65a17f98464e5f1f9b3f8.zip |
Fixed getUids by type filtering.
We used to simply return all uids.
Requires "sinksh upgrade"
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 8603787..630dae9 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -156,19 +156,19 @@ void DataStore::removeRevision(DataStore::Transaction &transaction, qint64 revis | |||
156 | transaction.openDatabase("revisionType").remove(QByteArray::number(revision)); | 156 | transaction.openDatabase("revisionType").remove(QByteArray::number(revision)); |
157 | } | 157 | } |
158 | 158 | ||
159 | void DataStore::recordUid(DataStore::Transaction &transaction, const QByteArray &uid) | 159 | void DataStore::recordUid(DataStore::Transaction &transaction, const QByteArray &uid, const QByteArray &type) |
160 | { | 160 | { |
161 | transaction.openDatabase("uids").write(uid, ""); | 161 | transaction.openDatabase(type + "uids").write(uid, ""); |
162 | } | 162 | } |
163 | 163 | ||
164 | void DataStore::removeUid(DataStore::Transaction &transaction, const QByteArray &uid) | 164 | void DataStore::removeUid(DataStore::Transaction &transaction, const QByteArray &uid, const QByteArray &type) |
165 | { | 165 | { |
166 | transaction.openDatabase("uids").remove(uid); | 166 | transaction.openDatabase(type + "uids").remove(uid); |
167 | } | 167 | } |
168 | 168 | ||
169 | void DataStore::getUids(const Transaction &transaction, const std::function<void(const QByteArray &uid)> &callback) | 169 | void DataStore::getUids(const QByteArray &type, const Transaction &transaction, const std::function<void(const QByteArray &uid)> &callback) |
170 | { | 170 | { |
171 | transaction.openDatabase("uids").scan("", [&] (const QByteArray &key, const QByteArray &) { | 171 | transaction.openDatabase(type + "uids").scan("", [&] (const QByteArray &key, const QByteArray &) { |
172 | callback(key); | 172 | callback(key); |
173 | return true; | 173 | return true; |
174 | }); | 174 | }); |