24 namespace OpenAB_Sync {
223 virtual void getStats(
unsigned int& locallyAdded,
224 unsigned int& locallyModified,
225 unsigned int& locallyRemoved,
226 unsigned int& remotelyAdded,
227 unsigned int& remotelyModified,
228 unsigned int& remotelyRemoved) = 0;
239 bool addPhase(
const std::string& name,
const std::vector<std::string>& ignoreFields);
258 virtual void print(
const std::string& msg) = 0;
271 virtual void syncProgress(
const std::string& phaseName,
double progress,
unsigned int numProcessedItems) = 0;
295 Phase(
const std::string& n,
const std::vector<std::string> & ignore) :
336 void addItem(
const std::string& remoteId,
const std::string& remoteRevision,
337 const std::string& localId,
const std::string& localRevision);
345 void removeItem(
const std::string& remoteId,
const std::string& localId);
382 bool hasLocalId(
const std::string& uid)
const;
395 std::string
toJSON()
const;
402 bool fromJSON(
const std::string& json);
473 std::string remoteSyncToken;
474 std::string localSyncToken;
475 std::map<std::string, std::string> remoteRevisions;
476 std::map<std::string, std::string> localRevisions;
477 std::map<std::string, std::string> remoteToLocalIdMapping;
479 std::map<std::string, SyncMetadataState> remoteState;
480 std::map<std::string, SyncMetadataState> localState;
eInit
Definition: Sync.hpp:142
Generic storage for Sync plugin parameters. Allows to store map of parameters with different types (O...
Definition: Sync.hpp:82
virtual void getStats(unsigned int &locallyAdded, unsigned int &locallyModified, unsigned int &locallyRemoved, unsigned int &remotelyAdded, unsigned int &remotelyModified, unsigned int &remotelyRemoved)=0
Returns statistics of synchronization.
virtual enum eSuspend suspend()=0
Suspends synchronization (if used OpenAB_Source::Source plugin supports it)
virtual void synchronize()=0
Synchronizes data.
std::vector< std::string > ignoredFields
Definition: Sync.hpp:300
virtual void syncProgress(const std::string &phaseName, double progress, unsigned int numProcessedItems)=0
Informs about progress of synchronization.
eCancel
Definition: Sync.hpp:172
virtual ~SyncCallback()
Definition: Sync.hpp:253
OpenAB_Source::Parameters localSourcePluginParams
Parameters to be used by local OpenAB_Source::Source plugin.
Definition: Sync.hpp:104
virtual void metadataUpdated(const std::string &)
Informs that synchronization metadata has been updated.
Definition: Sync.hpp:289
virtual void syncPhaseFinished(const std::string &name)=0
Informs about end of synchronization phase.
eResume
Definition: Sync.hpp:202
OpenAB_Storage::Parameters remoteStoragePluginParams
Parameters to be used by remote OpenAB_Storage::Storage plugin.
Definition: Sync.hpp:120
DECLARE_PLUGIN_INTERFACE(OpenAB_Sync, Sync, Parameters)
bool addPhase(const std::string &name, const std::vector< std::string > &ignoreFields)
Adds new phase to synchronization process.
Definition: Sync.cpp:34
Virtual class that provide all the callback routines to control the synchronization.
Definition: Sync.hpp:249
OpenAB_Source::Parameters remoteSourcePluginParams
Parameters to be used by remote OpenAB_Source::Source plugin.
Definition: Sync.hpp:109
SyncCallback()
Definition: Sync.hpp:252
Parameters()
Default constructor.
Definition: Sync.cpp:17
~Parameters()
Destructor, virtual by default.
Definition: Sync.cpp:29
Phase(const std::string &n, const std::vector< std::string > &ignore)
Definition: Sync.hpp:295
std::string name
Definition: Sync.hpp:299
OpenAB_Plugin::GenericParameters Parameters
Use generic parameters.
Definition: Source.hpp:70
std::vector< Phase > phases
Definition: Sync.hpp:302
virtual ~Sync()
Destructor, virtual by default.
Definition: Sync.hpp:137
Documentation for class Sync plugin interface.
Definition: Sync.hpp:126
virtual void syncFinished(const enum OpenAB_Sync::Sync::eSync &result)=0
Informs about end of synchronization.
virtual enum eInit init()=0
Initializes Sync.
virtual enum eResume resume()=0
Resumes synchronization (if used OpenAB_Source::Source plugin supports it)
eSuspend
Definition: Sync.hpp:187
Sync()
Constructor.
Definition: Sync.hpp:132
virtual enum eCancel cancel()=0
Cancels synchronization.
virtual void syncPhaseStarted(const std::string &name)=0
Informs about start of next synchronization phase.
OpenAB_Storage::Parameters localStoragePluginParams
parameters to be used by local OpenAB_Storage::Storage plugin
Definition: Sync.hpp:115
Generic storage for plugin parameters. Allows to store map of parameters with different types (OpenAB...
Definition: GenericParameters.hpp:25
void clearPhases()
Removes all previously defined synchronization phases.
Definition: Sync.cpp:51
eSync
Definition: Sync.hpp:156
virtual void print(const std::string &msg)=0
Dummy funtion used to provide debug messages from Sync.