summaryrefslogtreecommitdiffstats
path: root/common/genericresource.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/genericresource.h')
-rw-r--r--common/genericresource.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/common/genericresource.h b/common/genericresource.h
index d71061c..4ae2645 100644
--- a/common/genericresource.h
+++ b/common/genericresource.h
@@ -19,7 +19,7 @@
19 */ 19 */
20#pragma once 20#pragma once
21 21
22#include <akonadi2common_export.h> 22#include <sinkcommon_export.h>
23#include <resource.h> 23#include <resource.h>
24#include <messagequeue.h> 24#include <messagequeue.h>
25#include <flatbuffers/flatbuffers.h> 25#include <flatbuffers/flatbuffers.h>
@@ -29,7 +29,7 @@
29class CommandProcessor; 29class CommandProcessor;
30class ChangeReplay; 30class ChangeReplay;
31 31
32namespace Akonadi2 32namespace Sink
33{ 33{
34class Pipeline; 34class Pipeline;
35class Preprocessor; 35class Preprocessor;
@@ -37,7 +37,7 @@ class Preprocessor;
37/** 37/**
38 * Generic Resource implementation. 38 * Generic Resource implementation.
39 */ 39 */
40class AKONADI2COMMON_EXPORT GenericResource : public Resource 40class SINKCOMMON_EXPORT GenericResource : public Resource
41{ 41{
42public: 42public:
43 GenericResource(const QByteArray &resourceInstanceIdentifier, const QSharedPointer<Pipeline> &pipeline = QSharedPointer<Pipeline>()); 43 GenericResource(const QByteArray &resourceInstanceIdentifier, const QSharedPointer<Pipeline> &pipeline = QSharedPointer<Pipeline>());
@@ -45,7 +45,7 @@ public:
45 45
46 virtual void processCommand(int commandId, const QByteArray &data) Q_DECL_OVERRIDE; 46 virtual void processCommand(int commandId, const QByteArray &data) Q_DECL_OVERRIDE;
47 virtual KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; 47 virtual KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE;
48 virtual KAsync::Job<void> synchronizeWithSource(Akonadi2::Storage &mainStore, Akonadi2::Storage &synchronizationStore); 48 virtual KAsync::Job<void> synchronizeWithSource(Sink::Storage &mainStore, Sink::Storage &synchronizationStore);
49 virtual KAsync::Job<void> processAllMessages() Q_DECL_OVERRIDE; 49 virtual KAsync::Job<void> processAllMessages() Q_DECL_OVERRIDE;
50 virtual void setLowerBoundRevision(qint64 revision) Q_DECL_OVERRIDE; 50 virtual void setLowerBoundRevision(qint64 revision) Q_DECL_OVERRIDE;
51 virtual KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue); 51 virtual KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue);
@@ -60,34 +60,34 @@ private Q_SLOTS:
60 60
61protected: 61protected:
62 void enableChangeReplay(bool); 62 void enableChangeReplay(bool);
63 void addType(const QByteArray &type, DomainTypeAdaptorFactoryInterface::Ptr factory, const QVector<Akonadi2::Preprocessor*> &preprocessors); 63 void addType(const QByteArray &type, DomainTypeAdaptorFactoryInterface::Ptr factory, const QVector<Sink::Preprocessor*> &preprocessors);
64 virtual KAsync::Job<void> replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value); 64 virtual KAsync::Job<void> replay(Sink::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value);
65 void onProcessorError(int errorCode, const QString &errorMessage); 65 void onProcessorError(int errorCode, const QString &errorMessage);
66 void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data); 66 void enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data);
67 67
68 static void createEntity(const QByteArray &localId, const QByteArray &bufferType, const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, DomainTypeAdaptorFactoryInterface &adaptorFactory, std::function<void(const QByteArray &)> callback); 68 static void createEntity(const QByteArray &localId, const QByteArray &bufferType, const Sink::ApplicationDomain::ApplicationDomainType &domainObject, DomainTypeAdaptorFactoryInterface &adaptorFactory, std::function<void(const QByteArray &)> callback);
69 static void modifyEntity(const QByteArray &localId, qint64 revision, const QByteArray &bufferType, const Akonadi2::ApplicationDomain::ApplicationDomainType &domainObject, DomainTypeAdaptorFactoryInterface &adaptorFactory, std::function<void(const QByteArray &)> callback); 69 static void modifyEntity(const QByteArray &localId, qint64 revision, const QByteArray &bufferType, const Sink::ApplicationDomain::ApplicationDomainType &domainObject, DomainTypeAdaptorFactoryInterface &adaptorFactory, std::function<void(const QByteArray &)> callback);
70 static void deleteEntity(const QByteArray &localId, qint64 revision, const QByteArray &bufferType, std::function<void(const QByteArray &)> callback); 70 static void deleteEntity(const QByteArray &localId, qint64 revision, const QByteArray &bufferType, std::function<void(const QByteArray &)> callback);
71 71
72 /** 72 /**
73 * Records a localId to remoteId mapping 73 * Records a localId to remoteId mapping
74 */ 74 */
75 void recordRemoteId(const QByteArray &bufferType, const QByteArray &localId, const QByteArray &remoteId, Akonadi2::Storage::Transaction &transaction); 75 void recordRemoteId(const QByteArray &bufferType, const QByteArray &localId, const QByteArray &remoteId, Sink::Storage::Transaction &transaction);
76 void removeRemoteId(const QByteArray &bufferType, const QByteArray &localId, const QByteArray &remoteId, Akonadi2::Storage::Transaction &transaction); 76 void removeRemoteId(const QByteArray &bufferType, const QByteArray &localId, const QByteArray &remoteId, Sink::Storage::Transaction &transaction);
77 77
78 /** 78 /**
79 * Tries to find a local id for the remote id, and creates a new local id otherwise. 79 * Tries to find a local id for the remote id, and creates a new local id otherwise.
80 * 80 *
81 * The new local id is recorded in the local to remote id mapping. 81 * The new local id is recorded in the local to remote id mapping.
82 */ 82 */
83 QByteArray resolveRemoteId(const QByteArray &type, const QByteArray &remoteId, Akonadi2::Storage::Transaction &transaction); 83 QByteArray resolveRemoteId(const QByteArray &type, const QByteArray &remoteId, Sink::Storage::Transaction &transaction);
84 84
85 /** 85 /**
86 * Tries to find a remote id for a local id. 86 * Tries to find a remote id for a local id.
87 * 87 *
88 * This can fail if the entity hasn't been written back to the server yet. 88 * This can fail if the entity hasn't been written back to the server yet.
89 */ 89 */
90 QByteArray resolveLocalId(const QByteArray &bufferType, const QByteArray &localId, Akonadi2::Storage::Transaction &transaction); 90 QByteArray resolveLocalId(const QByteArray &bufferType, const QByteArray &localId, Sink::Storage::Transaction &transaction);
91 91
92 /** 92 /**
93 * A synchronous algorithm to remove entities that are no longer existing. 93 * A synchronous algorithm to remove entities that are no longer existing.
@@ -99,14 +99,14 @@ protected:
99 * 99 *
100 * All functions are called synchronously, and both @param entryGenerator and @param exists need to be synchronous. 100 * All functions are called synchronously, and both @param entryGenerator and @param exists need to be synchronous.
101 */ 101 */
102 void scanForRemovals(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction, const QByteArray &bufferType, const std::function<void(const std::function<void(const QByteArray &key)> &callback)> &entryGenerator, std::function<bool(const QByteArray &remoteId)> exists); 102 void scanForRemovals(Sink::Storage::Transaction &transaction, Sink::Storage::Transaction &synchronizationTransaction, const QByteArray &bufferType, const std::function<void(const std::function<void(const QByteArray &key)> &callback)> &entryGenerator, std::function<bool(const QByteArray &remoteId)> exists);
103 103
104 /** 104 /**
105 * An algorithm to create or modify the entity. 105 * An algorithm to create or modify the entity.
106 * 106 *
107 * Depending on whether the entity is locally available, or has changed. 107 * Depending on whether the entity is locally available, or has changed.
108 */ 108 */
109 void createOrModify(Akonadi2::Storage::Transaction &transaction, Akonadi2::Storage::Transaction &synchronizationTransaction, DomainTypeAdaptorFactoryInterface &adaptorFactory, const QByteArray &bufferType, const QByteArray &remoteId, const Akonadi2::ApplicationDomain::ApplicationDomainType &entity); 109 void createOrModify(Sink::Storage::Transaction &transaction, Sink::Storage::Transaction &synchronizationTransaction, DomainTypeAdaptorFactoryInterface &adaptorFactory, const QByteArray &bufferType, const QByteArray &remoteId, const Sink::ApplicationDomain::ApplicationDomainType &entity);
110 110
111 MessageQueue mUserQueue; 111 MessageQueue mUserQueue;
112 MessageQueue mSynchronizerQueue; 112 MessageQueue mSynchronizerQueue;