summaryrefslogtreecommitdiffstats
path: root/common/storage_common.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-09 22:01:35 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-11 01:01:13 +0100
commit5f7262f5c410cf3f36116c221d28dd393664228d (patch)
tree5c3fb21cd31835470bdd87cd467a3c6ef0659fed /common/storage_common.cpp
parent3207343cbd4484950155146ab632b8304b70d640 (diff)
downloadsink-5f7262f5c410cf3f36116c221d28dd393664228d.tar.gz
sink-5f7262f5c410cf3f36116c221d28dd393664228d.zip
add another read method and expose a basic error handler for convenience
also, add some todos
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r--common/storage_common.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp
index 246611c..6263bf2 100644
--- a/common/storage_common.cpp
+++ b/common/storage_common.cpp
@@ -9,6 +9,11 @@ void errorHandler(const Storage::Error &error)
9 std::cerr << "Read error in " << error.store << ", code " << error.code << ", message: " << error.message << std::endl; 9 std::cerr << "Read error in " << error.store << ", code " << error.code << ", message: " << error.message << std::endl;
10} 10}
11 11
12std::function<void(const Storage::Error &error)> Storage::basicErrorHandler()
13{
14 return errorHandler;
15}
16
12void Storage::read(const std::string &sKey, const std::function<bool(const std::string &value)> &resultHandler) 17void Storage::read(const std::string &sKey, const std::function<bool(const std::string &value)> &resultHandler)
13{ 18{
14 read(sKey, resultHandler, &errorHandler); 19 read(sKey, resultHandler, &errorHandler);
@@ -21,6 +26,6 @@ void Storage::read(const std::string &sKey, const std::function<bool(void *ptr,
21 26
22void Storage::scan(const std::string &sKey, const std::function<bool(void *keyPtr, int keySize, void *valuePtr, int valueSize)> &resultHandler) 27void Storage::scan(const std::string &sKey, const std::function<bool(void *keyPtr, int keySize, void *valuePtr, int valueSize)> &resultHandler)
23{ 28{
24 scan(sKey, resultHandler, &errorHandler); 29 scan(sKey.data(), sKey.size(), resultHandler, &errorHandler);
25} 30}
26 31