diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-11 17:32:30 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-11 17:32:30 +0200 |
commit | c3a20160d4ff52c8ec288f6a42f7e136064fb493 (patch) | |
tree | 866ff1850a7c160ed39494a989f18aef182d2d2f /common | |
parent | d6e6cab8b284167a9c8fd30ae669354d8315b3aa (diff) | |
download | sink-c3a20160d4ff52c8ec288f6a42f7e136064fb493.tar.gz sink-c3a20160d4ff52c8ec288f6a42f7e136064fb493.zip |
Replay removals.
Now we just have to avoid removing the revision too early from the
resource.
Diffstat (limited to 'common')
-rw-r--r-- | common/clientapi.h | 4 | ||||
-rw-r--r-- | common/entitystorage.cpp | 8 | ||||
-rw-r--r-- | common/facade.h | 7 |
3 files changed, 10 insertions, 9 deletions
diff --git a/common/clientapi.h b/common/clientapi.h index 04433f8..e467b8f 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -175,9 +175,9 @@ public: | |||
175 | //Potentially move to separate thread as well | 175 | //Potentially move to separate thread as well |
176 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceName(resourceIdentifier), resourceIdentifier); | 176 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceName(resourceIdentifier), resourceIdentifier); |
177 | if (facade) { | 177 | if (facade) { |
178 | facade->remove(domainObject).template then<void>([facade](){}, [](int errorCode, const QString &error) { | 178 | return facade->remove(domainObject).template then<void>([facade](){}, [](int errorCode, const QString &error) { |
179 | Warning() << "Failed to remove"; | 179 | Warning() << "Failed to remove"; |
180 | }).exec().waitForFinished(); | 180 | }); |
181 | } | 181 | } |
182 | return KAsync::error<void>(-1, "Failed to create a facade"); | 182 | return KAsync::error<void>(-1, "Failed to create a facade"); |
183 | } | 183 | } |
diff --git a/common/entitystorage.cpp b/common/entitystorage.cpp index b77b481..b19fe0a 100644 --- a/common/entitystorage.cpp +++ b/common/entitystorage.cpp | |||
@@ -58,7 +58,11 @@ void EntityStorageBase::readEntity(const Akonadi2::Storage::Transaction &transac | |||
58 | auto operation = metadataBuffer->operation(); | 58 | auto operation = metadataBuffer->operation(); |
59 | 59 | ||
60 | auto domainObject = create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)); | 60 | auto domainObject = create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)); |
61 | resultCallback(domainObject, operation); | 61 | if (operation == Akonadi2::Operation_Removal) { |
62 | resultCallback(create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)), operation); | ||
63 | } else { | ||
64 | resultCallback(create(key, revision, mDomainTypeAdaptorFactory->createAdaptor(entity)), operation); | ||
65 | } | ||
62 | return false; | 66 | return false; |
63 | }, mBufferType); | 67 | }, mBufferType); |
64 | } | 68 | } |
@@ -124,7 +128,7 @@ ResultSet EntityStorageBase::getResultSet(const Akonadi2::Query &query, Akonadi2 | |||
124 | const qint64 topRevision = Akonadi2::Storage::maxRevision(transaction); | 128 | const qint64 topRevision = Akonadi2::Storage::maxRevision(transaction); |
125 | QSet<QByteArray> remainingFilters = query.propertyFilter.keys().toSet(); | 129 | QSet<QByteArray> remainingFilters = query.propertyFilter.keys().toSet(); |
126 | ResultSet resultSet; | 130 | ResultSet resultSet; |
127 | const bool initialQuery = (baseRevision == 0); | 131 | const bool initialQuery = (baseRevision == 1); |
128 | if (initialQuery) { | 132 | if (initialQuery) { |
129 | Trace() << "Initial result set update"; | 133 | Trace() << "Initial result set update"; |
130 | resultSet = loadInitialResultSet(query, transaction, remainingFilters); | 134 | resultSet = loadInitialResultSet(query, transaction, remainingFilters); |
diff --git a/common/facade.h b/common/facade.h index 5ed3bde..38388c7 100644 --- a/common/facade.h +++ b/common/facade.h | |||
@@ -54,11 +54,8 @@ public: | |||
54 | { | 54 | { |
55 | //TODO: JOBAPI: that last empty .then should not be necessary | 55 | //TODO: JOBAPI: that last empty .then should not be necessary |
56 | //TODO: remove newRevision | 56 | //TODO: remove newRevision |
57 | if (mLatestRevision == newRevision && mLatestRevision > 0) { | 57 | return queryFunction(mLatestRevision + 1).then<void, qint64>([this](qint64 revision) { |
58 | return KAsync::null<void>(); | 58 | mLatestRevision = revision; |
59 | } | ||
60 | return queryFunction(mLatestRevision).then<void, qint64>([this](qint64 revision) { | ||
61 | mLatestRevision = revision + 1; | ||
62 | }).then<void>([](){}); | 59 | }).then<void>([](){}); |
63 | } | 60 | } |
64 | 61 | ||