diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-09-11 09:31:24 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-09-11 09:31:24 +0200 |
commit | 50f737b8549fb1b380c753d36be3fafe0ec4a768 (patch) | |
tree | 63dc679d19382bba8e9100d20822d0c502e3dcc7 /common/storage.h | |
parent | 2554645a86359ec4cf805c8dee0e347b802776e0 (diff) | |
download | sink-50f737b8549fb1b380c753d36be3fafe0ec4a768.tar.gz sink-50f737b8549fb1b380c753d36be3fafe0ec4a768.zip |
Storage: substring search and findLatest
Diffstat (limited to 'common/storage.h')
-rw-r--r-- | common/storage.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/common/storage.h b/common/storage.h index d186b2e..98b12ed 100644 --- a/common/storage.h +++ b/common/storage.h | |||
@@ -76,9 +76,13 @@ public: | |||
76 | * | 76 | * |
77 | * @return The number of values retrieved. | 77 | * @return The number of values retrieved. |
78 | */ | 78 | */ |
79 | int scan(const QByteArray &k, | 79 | int scan(const QByteArray &key, |
80 | const std::function<bool(const QByteArray &key, const QByteArray &value)> &resultHandler, | 80 | const std::function<bool(const QByteArray &key, const QByteArray &value)> &resultHandler, |
81 | const std::function<void(const Storage::Error &error)> &errorHandler = std::function<void(const Storage::Error &error)>()) const; | 81 | const std::function<void(const Storage::Error &error)> &errorHandler = std::function<void(const Storage::Error &error)>(), bool findSubstringKeys = false) const; |
82 | |||
83 | void findLatest(const QByteArray &uid, | ||
84 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, | ||
85 | const std::function<void(const Storage::Error &error)> &errorHandler = std::function<void(const Storage::Error &error)>()) const; | ||
82 | 86 | ||
83 | NamedDatabase(NamedDatabase&& other) : d(other.d) | 87 | NamedDatabase(NamedDatabase&& other) : d(other.d) |
84 | { | 88 | { |
@@ -170,6 +174,9 @@ public: | |||
170 | static bool isInternalKey(void *key, int keySize); | 174 | static bool isInternalKey(void *key, int keySize); |
171 | static bool isInternalKey(const QByteArray &key); | 175 | static bool isInternalKey(const QByteArray &key); |
172 | 176 | ||
177 | static QByteArray assembleKey(const QByteArray &key, qint64 revision); | ||
178 | static QByteArray uidFromKey(const QByteArray &key); | ||
179 | |||
173 | private: | 180 | private: |
174 | std::function<void(const Storage::Error &error)> mErrorHandler; | 181 | std::function<void(const Storage::Error &error)> mErrorHandler; |
175 | 182 | ||