diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-10 15:03:02 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-10 15:03:30 +0200 |
commit | 7890b7fcb4ffdfc570e306983787bc884bf0f62b (patch) | |
tree | 3e721806ab0e5cba642c0b7e78ff81b5819f3bf2 /common/storage_common.cpp | |
parent | 1319b45f5f389c94877ef58458bb60795042129e (diff) | |
download | sink-7890b7fcb4ffdfc570e306983787bc884bf0f62b.tar.gz sink-7890b7fcb4ffdfc570e306983787bc884bf0f62b.zip |
Added uid index
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 07d0f04..81a38c7 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -146,6 +146,24 @@ void DataStore::removeRevision(DataStore::Transaction &transaction, qint64 revis | |||
146 | transaction.openDatabase("revisionType").remove(QByteArray::number(revision)); | 146 | transaction.openDatabase("revisionType").remove(QByteArray::number(revision)); |
147 | } | 147 | } |
148 | 148 | ||
149 | void DataStore::recordUid(DataStore::Transaction &transaction, const QByteArray &uid) | ||
150 | { | ||
151 | transaction.openDatabase("uids").write(uid, ""); | ||
152 | } | ||
153 | |||
154 | void DataStore::removeUid(DataStore::Transaction &transaction, const QByteArray &uid) | ||
155 | { | ||
156 | transaction.openDatabase("uids").remove(uid); | ||
157 | } | ||
158 | |||
159 | void DataStore::getUids(const Transaction &transaction, const std::function<void(const QByteArray &uid)> &callback) | ||
160 | { | ||
161 | transaction.openDatabase("uids").scan("", [&] (const QByteArray &key, const QByteArray &) { | ||
162 | callback(key); | ||
163 | return true; | ||
164 | }); | ||
165 | } | ||
166 | |||
149 | bool DataStore::isInternalKey(const char *key) | 167 | bool DataStore::isInternalKey(const char *key) |
150 | { | 168 | { |
151 | return key && strncmp(key, s_internalPrefix, s_internalPrefixSize) == 0; | 169 | return key && strncmp(key, s_internalPrefix, s_internalPrefixSize) == 0; |