diff options
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index d8b1f42..81a38c7 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -28,7 +28,7 @@ SINK_DEBUG_AREA("storage") | |||
28 | 28 | ||
29 | QDebug& operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error) | 29 | QDebug& operator<<(QDebug &dbg, const Sink::Storage::DataStore::Error &error) |
30 | { | 30 | { |
31 | dbg << error.message; | 31 | dbg << error.message << "Code: " << error.code << "Db: " << error.store; |
32 | return dbg; | 32 | return dbg; |
33 | } | 33 | } |
34 | 34 | ||
@@ -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; |