summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2011-10-12 09:49:32 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2011-10-17 13:17:58 +0200
commit1421769db83968deaa5430d95e0adb3ca6b79950 (patch)
tree8d9b908e11ab1b30326257446ee1797b2fdb84cc
parent58b0f108716f3c5bd1cd99be493ec1037a807a73 (diff)
SyncSource: allow StartDataRead/beginSync() to force a slow sync
This is needed for ActiveSync, which can detect inside beginSync() that the sync key became invalid and then has to fall back to a slow sync. It is done by asking the engine to call StartDataRead earlier (via <plugin_earlystartdataread>) and documenting the special 508 error code. Depends on support for both in libsynthesis, thus the bumped version number of it. Normally SyncEvolution is meant to never throw an exception unless something fatal happens, so it would have been better to add a return code to beginSync(). But that is a fairly intrusive change, so instead the simpler "use exception" solution is used. The change can still be made later on.
-rw-r--r--src/syncevo/SyncML.h2
-rw-r--r--src/syncevo/SyncSource.cpp1
-rw-r--r--src/syncevo/SyncSource.h7
3 files changed, 9 insertions, 1 deletions
diff --git a/src/syncevo/SyncML.h b/src/syncevo/SyncML.h
index 97ed30fe..b61fcce2 100644
--- a/src/syncevo/SyncML.h
+++ b/src/syncevo/SyncML.h
@@ -120,6 +120,8 @@ enum SyncMLStatus {
STATUS_ALREADY_EXISTS = 418,
/** command failed / fatal DB error */
STATUS_FATAL = 500,
+ /** in Synthesis StartDataRead: slow sync forced by backend */
+ STATUS_SLOW_SYNC_508 = 508,
/** general DB error */
STATUS_DATASTORE_FAILURE = 510,
/** database / memory full error */
diff --git a/src/syncevo/SyncSource.cpp b/src/syncevo/SyncSource.cpp
index dd881239..de3fd244 100644
--- a/src/syncevo/SyncSource.cpp
+++ b/src/syncevo/SyncSource.cpp
@@ -97,6 +97,7 @@ void SyncSourceBase::getDatastoreXML(string &xml, XMLConfigFragments &fragments)
xmlstream <<
" <plugin_module>SyncEvolution</plugin_module>\n"
+ " <plugin_earlystartdataread>yes</plugin_earlystartdataread>\n"
" <plugin_datastoreadmin>" <<
(serverModeEnabled() ? "yes" : "no") <<
"</plugin_datastoreadmin>\n"
diff --git a/src/syncevo/SyncSource.h b/src/syncevo/SyncSource.h
index f05dcded..e63bedeb 100644
--- a/src/syncevo/SyncSource.h
+++ b/src/syncevo/SyncSource.h
@@ -1322,7 +1322,12 @@ class SyncSourceSession : virtual public SyncSourceBase {
/**
* called before Synthesis engine starts to ask for changes and item data
*
- * See BeingDataRead for details.
+ * May throw a STATUS_SLOW_SYNC_508 StatusException if an
+ * incremental sync is not possible. In that case, preparations
+ * for a slow sync must have completed successfully inside the
+ * beginSync() call. It is not going to get called again.
+ *
+ * See StartDataRead for details.
*
* @param lastToken identifies the last completed sync
* @param resumeToken identifies a more recent sync which needs to be resumed;