From 9448988676c524e4080e18e861dbd7e1def84e44 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 16 Jul 2017 19:18:59 +0200 Subject: No return value needed here. --- common/storage/entitystore.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'common/storage') diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 22e5ae3..1ac87b7 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp @@ -516,9 +516,8 @@ void EntityStore::readLatest(const QByteArray &type, const QByteArray &uid, cons { auto db = DataStore::mainDatabase(d->getTransaction(), type); db.findLatest(uid, - [=](const QByteArray &key, const QByteArray &value) -> bool { + [=](const QByteArray &key, const QByteArray &value) { callback(DataStore::uidFromKey(key), Sink::EntityBuffer(value.data(), value.size())); - return false; }, [&](const DataStore::Error &error) { SinkWarningCtx(d->logCtx) << "Error during query: " << error.message << uid; }); } @@ -653,7 +652,7 @@ bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) bool alreadyRemoved = false; DataStore::mainDatabase(d->transaction, type) .findLatest(uid, - [&found, &alreadyRemoved](const QByteArray &key, const QByteArray &data) -> bool { + [&found, &alreadyRemoved](const QByteArray &key, const QByteArray &data) { auto entity = GetEntity(data.data()); if (entity && entity->metadata()) { auto metadata = GetMetadata(entity->metadata()->Data()); @@ -662,7 +661,6 @@ bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) alreadyRemoved = true; } } - return false; }, [&](const DataStore::Error &error) { SinkWarningCtx(d->logCtx) << "Failed to read old revision from storage: " << error.message; }); if (!found) { -- cgit v1.2.3 From a98311fbc807b83ecfc65a17f98464e5f1f9b3f8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 7 Sep 2017 02:34:10 +0200 Subject: Fixed getUids by type filtering. We used to simply return all uids. Requires "sinksh upgrade" --- common/storage/entitystore.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/storage') diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 1ac87b7..5514e31 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp @@ -267,7 +267,7 @@ bool EntityStore::add(const QByteArray &type, ApplicationDomain::ApplicationDoma [&](const DataStore::Error &error) { SinkWarningCtx(d->logCtx) << "Failed to write entity" << entity.identifier() << newRevision; }); DataStore::setMaxRevision(d->transaction, newRevision); DataStore::recordRevision(d->transaction, newRevision, entity.identifier(), type); - DataStore::recordUid(d->transaction, entity.identifier()); + DataStore::recordUid(d->transaction, entity.identifier(), type); SinkTraceCtx(d->logCtx) << "Wrote entity: " << entity.identifier() << type << newRevision; return true; } @@ -379,7 +379,7 @@ bool EntityStore::remove(const QByteArray &type, const Sink::ApplicationDomain:: [&](const DataStore::Error &error) { SinkWarningCtx(d->logCtx) << "Failed to write entity" << uid << newRevision; }); DataStore::setMaxRevision(d->transaction, newRevision); DataStore::recordRevision(d->transaction, newRevision, uid, type); - DataStore::removeUid(d->transaction, uid); + DataStore::removeUid(d->transaction, uid, type); return true; } @@ -638,7 +638,7 @@ ApplicationDomain::ApplicationDomainType EntityStore::readPrevious(const QByteAr void EntityStore::readAllUids(const QByteArray &type, const std::function callback) { - DataStore::getUids(d->getTransaction(), callback); + DataStore::getUids(type, d->getTransaction(), callback); } bool EntityStore::contains(const QByteArray &type, const QByteArray &uid) -- cgit v1.2.3