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/utils.h | |
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/utils.h')
-rw-r--r-- | common/utils.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/utils.h b/common/utils.h index 253de61..7066d79 100644 --- a/common/utils.h +++ b/common/utils.h | |||
@@ -20,6 +20,17 @@ | |||
20 | 20 | ||
21 | #include <QByteArray> | 21 | #include <QByteArray> |
22 | 22 | ||
23 | #include <cmath> | ||
24 | |||
23 | namespace Sink { | 25 | namespace Sink { |
24 | QByteArray createUuid(); | 26 | |
27 | QByteArray createUuid(); | ||
28 | |||
29 | template <typename T> | ||
30 | static QByteArray padNumber(T number) | ||
31 | { | ||
32 | static T uint_num_digits = (T)std::log10(std::numeric_limits<T>::max()) + 1; | ||
33 | return QByteArray::number(number).rightJustified(uint_num_digits, '0'); | ||
25 | } | 34 | } |
35 | |||
36 | } // namespace Sink | ||