From 1d713d9e2dbaf27de9da087f9270d260dfc40c31 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 21 Nov 2016 23:13:38 +0100 Subject: Folded the SourceWriteback into the Synchronizer. By concentrating all communication to the source in one place we get rid of several oddities. * Quite a bit of duplication since both need access to the synchronizationStore and the source. * We currently have an akward locking in place because both classes access the ync store. This is not easier to resolve cleanly. * The live of resource implementers becomes easier. * An implementation could elect to not use changereplay and always do a full sync... (maybe?) --- .../mailtransportresource.cpp | 40 ++++++---------------- 1 file changed, 11 insertions(+), 29 deletions(-) (limited to 'examples/mailtransportresource') diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 3fe551a..0688af6 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -23,7 +23,6 @@ #include "resourceconfig.h" #include "definitions.h" #include "domainadaptor.h" -#include "sourcewriteback.h" #include #include #include @@ -45,30 +44,6 @@ SINK_DEBUG_AREA("mailtransportresource") using namespace Sink; -//TODO fold into synchronizer -class MailtransportWriteback : public Sink::SourceWriteBack -{ -public: - MailtransportWriteback(const Sink::ResourceContext &resourceContext) : Sink::SourceWriteBack(resourceContext) - { - - } - - KAsync::Job replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList &changedProperties) Q_DECL_OVERRIDE - { - if (operation == Sink::Operation_Creation) { - SinkTrace() << "Dispatching message."; - // return send(mail, mSettings); - } else if (operation == Sink::Operation_Removal) { - } else if (operation == Sink::Operation_Modification) { - } - return KAsync::null(); - } - -public: - MailtransportResource::Settings mSettings; -}; - class MailtransportSynchronizer : public Sink::Synchronizer { public: MailtransportSynchronizer(const Sink::ResourceContext &resourceContext) @@ -134,6 +109,17 @@ public: }); } + KAsync::Job replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList &changedProperties) Q_DECL_OVERRIDE + { + if (operation == Sink::Operation_Creation) { + SinkTrace() << "Dispatching message."; + // return send(mail, mSettings); + } else if (operation == Sink::Operation_Removal) { + } else if (operation == Sink::Operation_Modification) { + } + return KAsync::null(); + } + public: QByteArray mResourceInstanceIdentifier; MailtransportResource::Settings mSettings; @@ -154,10 +140,6 @@ MailtransportResource::MailtransportResource(const Sink::ResourceContext &resour synchronizer->mSettings = mSettings; setupSynchronizer(synchronizer); - auto changereplay = QSharedPointer::create(resourceContext); - changereplay->mSettings = mSettings; - setupChangereplay(changereplay); - setupPreprocessors(ENTITY_TYPE_MAIL, QVector() << new MimeMessageMover << new MailPropertyExtractor); } -- cgit v1.2.3