diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-18 12:44:12 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:49 +0200 |
commit | 71a0167e0216f84588b492c84e92667847fbe5a5 (patch) | |
tree | 016718fe0ab13359e9738b9ddbf2450b05bb4603 /common/storage/entitystore.cpp | |
parent | 2a9c738b813133d398683596df6d41d355e3cb3b (diff) | |
download | sink-71a0167e0216f84588b492c84e92667847fbe5a5.tar.gz sink-71a0167e0216f84588b492c84e92667847fbe5a5.zip |
Use the ApplicationDomainType in the queries as well.
We have to access properties, so we need the mapper anyways, and the
ApplicationDomainType type shouldn't be a large overhead anyways.
Diffstat (limited to 'common/storage/entitystore.cpp')
-rw-r--r-- | common/storage/entitystore.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 9615eca..fe63f0b 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -184,6 +184,15 @@ void EntityStore::readLatest(const QByteArray &type, const QByteArray &uid, cons | |||
184 | }); | 184 | }); |
185 | } | 185 | } |
186 | 186 | ||
187 | void EntityStore::readLatest(const QByteArray &type, const QByteArray &uid, const std::function<void(const ApplicationDomain::ApplicationDomainType &, Sink::Operation)> callback) | ||
188 | { | ||
189 | readLatest(type, uid, [&](const QByteArray &uid, const EntityBuffer &buffer) { | ||
190 | auto adaptor = d->resourceContext.adaptorFactory(type).createAdaptor(buffer.entity()); | ||
191 | //TODO cache max revision for the duration of the transaction. | ||
192 | callback(ApplicationDomain::ApplicationDomainType{d->resourceContext.instanceId(), uid, DataStore::maxRevision(d->getTransaction()), adaptor}, buffer.operation()); | ||
193 | }); | ||
194 | } | ||
195 | |||
187 | ApplicationDomain::ApplicationDomainType EntityStore::readLatest(const QByteArray &type, const QByteArray &uid) | 196 | ApplicationDomain::ApplicationDomainType EntityStore::readLatest(const QByteArray &type, const QByteArray &uid) |
188 | { | 197 | { |
189 | ApplicationDomain::ApplicationDomainType dt; | 198 | ApplicationDomain::ApplicationDomainType dt; |