diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-05-24 12:10:24 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-24 12:17:15 +0200 |
commit | 0456cef80e909e545897ac9eb107fd832d4dfde8 (patch) | |
tree | 5878f19df4089c166637380850a6bc101fa20a82 /common/storage.h | |
parent | 7e910179f1349d1245211933d95cda2dc13cd617 (diff) | |
download | sink-0456cef80e909e545897ac9eb107fd832d4dfde8.tar.gz sink-0456cef80e909e545897ac9eb107fd832d4dfde8.zip |
Add findAllInRange function in the storage layer
Summary:
In preparation of the support for ranged queries.
Notes:
Since they are pretty similar, it could be nice to refactor `scan` and `findAllInRange` to use common 3rd function
Test Plan: This is tested in storagetest.cpp
Reviewers: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D13066
Diffstat (limited to 'common/storage.h')
-rw-r--r-- | common/storage.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/storage.h b/common/storage.h index bb8c1fa..a8c486c 100644 --- a/common/storage.h +++ b/common/storage.h | |||
@@ -109,6 +109,15 @@ public: | |||
109 | const std::function<void(const DataStore::Error &error)> &errorHandler = std::function<void(const DataStore::Error &error)>()) const; | 109 | const std::function<void(const DataStore::Error &error)> &errorHandler = std::function<void(const DataStore::Error &error)>()) const; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Finds all the keys and values whose keys are in a given range | ||
113 | * (inclusive). | ||
114 | */ | ||
115 | int findAllInRange(const QByteArray &lowerBound, const QByteArray &upperBound, | ||
116 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, | ||
117 | const std::function<void(const DataStore::Error &error)> &errorHandler = | ||
118 | std::function<void(const DataStore::Error &error)>()) const; | ||
119 | |||
120 | /** | ||
112 | * Returns true if the database contains the substring key. | 121 | * Returns true if the database contains the substring key. |
113 | */ | 122 | */ |
114 | bool contains(const QByteArray &uid); | 123 | bool contains(const QByteArray &uid); |