From 09aafbd1373b5d1152ac7a453a140a7f76c2e90e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 13 Nov 2015 19:34:47 +0100 Subject: It's starting to work --- common/facadeinterface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/facadeinterface.h') diff --git a/common/facadeinterface.h b/common/facadeinterface.h index 3a38db8..571a1e8 100644 --- a/common/facadeinterface.h +++ b/common/facadeinterface.h @@ -45,7 +45,7 @@ public: virtual KAsync::Job create(const DomainType &domainObject) = 0; virtual KAsync::Job modify(const DomainType &domainObject) = 0; virtual KAsync::Job remove(const DomainType &domainObject) = 0; - virtual KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) = 0; + virtual KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) = 0; }; template @@ -67,7 +67,7 @@ public: return KAsync::error(-1, "Failed to create a facade"); } - KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) + KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) { return KAsync::error(-1, "Failed to create a facade"); } -- cgit v1.2.3 From 0f24357d01bd8a278f03793db863d3f71ac37ef2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 18 Nov 2015 00:51:55 +0100 Subject: Don't use a smart pointer for the result provider We're not doing any lifetime management anyways. --- common/facadeinterface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/facadeinterface.h') diff --git a/common/facadeinterface.h b/common/facadeinterface.h index 571a1e8..7ec21bc 100644 --- a/common/facadeinterface.h +++ b/common/facadeinterface.h @@ -45,7 +45,7 @@ public: virtual KAsync::Job create(const DomainType &domainObject) = 0; virtual KAsync::Job modify(const DomainType &domainObject) = 0; virtual KAsync::Job remove(const DomainType &domainObject) = 0; - virtual KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) = 0; + virtual KAsync::Job load(const Query &query, Akonadi2::ResultProviderInterface &resultProvider) = 0; }; template @@ -67,7 +67,7 @@ public: return KAsync::error(-1, "Failed to create a facade"); } - KAsync::Job load(const Query &query, const QSharedPointer > &resultProvider) + KAsync::Job load(const Query &query, Akonadi2::ResultProviderInterface &resultProvider) { return KAsync::error(-1, "Failed to create a facade"); } -- cgit v1.2.3 From 5b41b26a349967acf2197f9f9228526193fd826e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 27 Nov 2015 17:30:04 +0100 Subject: Introduced a QueryRunner object The QueryRunner object lives for the duration of the query (so just for the initial query for non-live queries, and for the lifetime of the result model for live queries). It's supposed to handle all the threading internally and decouple the lifetime of the facade. --- common/facadeinterface.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'common/facadeinterface.h') diff --git a/common/facadeinterface.h b/common/facadeinterface.h index 7ec21bc..318abf3 100644 --- a/common/facadeinterface.h +++ b/common/facadeinterface.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "applicationdomaintype.h" #include "resultprovider.h" @@ -42,10 +43,32 @@ class StoreFacade { public: virtual ~StoreFacade(){}; QByteArray type() const { return ApplicationDomain::getTypeName(); } + + /** + * Create an entity in the store. + * + * The job returns succefully once the task has been successfully placed in the queue + */ virtual KAsync::Job create(const DomainType &domainObject) = 0; + + /** + * Modify an entity in the store. + * + * The job returns succefully once the task has been successfully placed in the queue + */ virtual KAsync::Job modify(const DomainType &domainObject) = 0; + + /** + * Remove an entity from the store. + * + * The job returns succefully once the task has been successfully placed in the queue + */ virtual KAsync::Job remove(const DomainType &domainObject) = 0; - virtual KAsync::Job load(const Query &query, Akonadi2::ResultProviderInterface &resultProvider) = 0; + + /** + * Load entities from the store. + */ + virtual QPair, typename Akonadi2::ResultEmitter::Ptr > load(const Query &query) = 0; }; template @@ -67,9 +90,9 @@ public: return KAsync::error(-1, "Failed to create a facade"); } - KAsync::Job load(const Query &query, Akonadi2::ResultProviderInterface &resultProvider) + QPair, typename Akonadi2::ResultEmitter::Ptr > load(const Query &query) { - return KAsync::error(-1, "Failed to create a facade"); + return qMakePair(KAsync::null(), typename Akonadi2::ResultEmitter::Ptr()); } }; -- cgit v1.2.3