diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-07-27 13:32:39 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-27 13:47:43 +0200 |
commit | d1838e575baeb6cd08011645609516acbdabd6c8 (patch) | |
tree | 035b99a4d324231c8c44e0e97905383266bacba6 /common/storage_common.cpp | |
parent | 1855b8356e4c427efdba4c932fa9f984e6ae5a43 (diff) | |
download | sink-d1838e575baeb6cd08011645609516acbdabd6c8.tar.gz sink-d1838e575baeb6cd08011645609516acbdabd6c8.zip |
New Key API in storage layer
Summary:
- Use object oriented paradigm for Keys / Identifiers /Revisions
- "Compress" keys by using byte representation of Uuids
- Still some cleaning left to do
- Also run some benchmarks
- I'm questioning whether files other than entitystore (tests excluded) are allowed to access this API
Reviewers: cmollekopf
Reviewed By: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D13735
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp index 057dce4..f96097a 100644 --- a/common/storage_common.cpp +++ b/common/storage_common.cpp | |||
@@ -194,23 +194,6 @@ bool DataStore::isInternalKey(const QByteArray &key) | |||
194 | return key.startsWith(s_internalPrefix); | 194 | return key.startsWith(s_internalPrefix); |
195 | } | 195 | } |
196 | 196 | ||
197 | QByteArray DataStore::assembleKey(const QByteArray &key, qint64 revision) | ||
198 | { | ||
199 | Q_ASSERT(revision <= 9223372036854775807); | ||
200 | Q_ASSERT(key.size() == s_lengthOfUid); | ||
201 | return key + QByteArray::number(revision).rightJustified(19, '0', false); | ||
202 | } | ||
203 | |||
204 | QByteArray DataStore::uidFromKey(const QByteArray &key) | ||
205 | { | ||
206 | return key.mid(0, s_lengthOfUid); | ||
207 | } | ||
208 | |||
209 | qint64 DataStore::revisionFromKey(const QByteArray &key) | ||
210 | { | ||
211 | return key.mid(s_lengthOfUid + 1).toLongLong(); | ||
212 | } | ||
213 | |||
214 | QByteArray DataStore::generateUid() | 197 | QByteArray DataStore::generateUid() |
215 | { | 198 | { |
216 | return createUuid(); | 199 | return createUuid(); |