diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-23 23:57:09 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-23 23:57:09 +0200 |
commit | 9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6 (patch) | |
tree | 7cf47fd2334487a0e4f2bfef73c8e09e165dc4cc /common/storage_lmdb.cpp | |
parent | ae0255bf8eb913004082278af27d69047503ea71 (diff) | |
download | sink-9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6.tar.gz sink-9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6.zip |
Removed convenience API
Diffstat (limited to 'common/storage_lmdb.cpp')
-rw-r--r-- | common/storage_lmdb.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 7fed830..a048a71 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -337,40 +337,6 @@ Storage::NamedDatabase Storage::Transaction::openDatabase(const QByteArray &db, | |||
337 | return Storage::NamedDatabase(p); | 337 | return Storage::NamedDatabase(p); |
338 | } | 338 | } |
339 | 339 | ||
340 | bool Storage::Transaction::write(const QByteArray &key, const QByteArray &value, const std::function<void(const Storage::Error &error)> &errorHandler) | ||
341 | { | ||
342 | auto eHandler = [this, errorHandler](const Storage::Error &error) { | ||
343 | d->error = true; | ||
344 | errorHandler ? errorHandler(error) : d->defaultErrorHandler(error); | ||
345 | }; | ||
346 | openDatabase("default", eHandler).write(key, value, eHandler); | ||
347 | d->implicitCommit = true; | ||
348 | |||
349 | return !d->error; | ||
350 | } | ||
351 | |||
352 | void Storage::Transaction::remove(const QByteArray &k, | ||
353 | const std::function<void(const Storage::Error &error)> &errorHandler) | ||
354 | { | ||
355 | auto eHandler = [this, errorHandler](const Storage::Error &error) { | ||
356 | d->error = true; | ||
357 | errorHandler ? errorHandler(error) : d->defaultErrorHandler(error); | ||
358 | }; | ||
359 | openDatabase("default", eHandler).remove(k, eHandler); | ||
360 | d->implicitCommit = true; | ||
361 | } | ||
362 | |||
363 | int Storage::Transaction::scan(const QByteArray &k, | ||
364 | const std::function<bool(const QByteArray &key, const QByteArray &value)> &resultHandler, | ||
365 | const std::function<void(const Storage::Error &error)> &errorHandler) const | ||
366 | { | ||
367 | auto db = openDatabase("default", std::function<void(const Storage::Error &error)>()); | ||
368 | if (db) { | ||
369 | return db.scan(k, resultHandler, errorHandler); | ||
370 | } | ||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | 340 | ||
375 | 341 | ||
376 | 342 | ||