summaryrefslogtreecommitdiffstats
path: root/common/storage_common.cpp
blob: bc1acc4275ecb024757d689d3f094ea15726613a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "storage.h"

#include <iostream>

void errorHandler(const Storage::Error &error)
{
    //TODO: allow this to be turned on / off globally
    //TODO: log $SOMEWHERE $SOMEHOW rather than just spit to stderr
    std::cerr << "Read error in " << error.store << ", code " << error.code << ", message: " << error.message << std::endl;
}

void Storage::read(const std::string &sKey, const std::function<bool(const std::string &value)> &resultHandler)
{
    read(sKey, resultHandler, &errorHandler);
}

void Storage::read(const std::string &sKey, const std::function<bool(void *ptr, int size)> &resultHandler)
{
    read(sKey, resultHandler, &errorHandler);
}