summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-07-11 10:23:41 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2013-07-11 10:23:41 +0200
commit630d756460970fbca31f9266d0235fd9d16012e7 (patch)
treebea74dddece186650365229f39981076796e38fb
parent6dc8122793a569a3bb849cea0eaadbfa480c401b (diff)
Plugin: allow overriding support for suspend/resume
Previously, the support for suspend/resume in a plugin DB was tied to the version of its API. This is a bit inflexible, because the API that the DB provides is orthogonal to the behavior of its implementation. For example, SyncEvolution always provides the same API, but sometimes decides to not store any data across sync sessions (caching mode which will always start anew as slow sync). In that mode, disabling suspend/resume support speeds up a sync involving 10000 items from 38s to 23s. To allow disabling suspend/resume, the new plugin capability CA_ResumeSupported can be set to "no" in the capability string. A different implementation with a datastore config option would also have been possible, but this approach was the least intrusive and easiest.
-rwxr-xr-xsrc/DB_interfaces/api_db/pluginapids.cpp5
-rwxr-xr-xsrc/DB_interfaces/api_db/pluginapids.h1
-rwxr-xr-xsrc/sysync_SDK/Sources/sync_dbapidef.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/src/DB_interfaces/api_db/pluginapids.cpp b/src/DB_interfaces/api_db/pluginapids.cpp
index 9a400b2..19aa009 100755
--- a/src/DB_interfaces/api_db/pluginapids.cpp
+++ b/src/DB_interfaces/api_db/pluginapids.cpp
@@ -113,6 +113,7 @@ void TPluginDSConfig::clear(void)
fPluginParams_Data.clear();
// - clear capabilities
fItemAsKey = false;
+ fResumeSupported = true;
fHasDeleteSyncSet = false;
// clear inherited
inherited::clear();
@@ -198,6 +199,8 @@ void TPluginDSConfig::localResolve(bool aLastPass)
fHasDeleteSyncSet = FlagOK(capaStr,CA_DeleteSyncSet,true);
// - Check for new method for data access (as keys instead of as text items)
fItemAsKey = FlagOK(capaStr,CA_ItemAsKey,true);
+ // - Allow module to choose whether it wants to support suspend/resume.
+ fResumeSupported = FlagOK(capaStr,CA_ResumeSupported,true);
// Check if engine is compatible
#ifndef DBAPI_TEXTITEMS
if (!fItemAsKey) SYSYNC_THROW(TConfigParseException("This engine does not support data items in text format"));
@@ -857,7 +860,7 @@ bool TPluginApiDS::dsResumeSupportedInDB(void)
{
if (fPluginDSConfigP->fDBApiConfig_Admin.Connected()) {
// we can do resume if plugin supports it
- return fPluginDSConfigP->fDBApiConfig_Admin.Version()>=sInt32(VE_InsertMapItem);
+ return fPluginDSConfigP->fResumeSupported && fPluginDSConfigP->fDBApiConfig_Admin.Version()>=sInt32(VE_InsertMapItem);
}
return inherited::dsResumeSupportedInDB();
} // TPluginApiDS::dsResumeSupportedInDB
diff --git a/src/DB_interfaces/api_db/pluginapids.h b/src/DB_interfaces/api_db/pluginapids.h
index 214a9fd..9ac3283 100755
--- a/src/DB_interfaces/api_db/pluginapids.h
+++ b/src/DB_interfaces/api_db/pluginapids.h
@@ -119,6 +119,7 @@ public:
uInt16 fPluginDbgMask_Admin;
// capabilities of connected plugin
bool fItemAsKey; // supports items as key
+ bool fResumeSupported; // extends version check in dsResumeSupportedInDB(), not supported if false
bool fHasDeleteSyncSet; // implements deleting sync set using DeleteSyncSet()
// public methods
// - create appropriate datastore from config, calls addTypeSupport as well
diff --git a/src/sysync_SDK/Sources/sync_dbapidef.h b/src/sysync_SDK/Sources/sync_dbapidef.h
index 7edbd2a..07acb97 100755
--- a/src/sysync_SDK/Sources/sync_dbapidef.h
+++ b/src/sysync_SDK/Sources/sync_dbapidef.h
@@ -266,6 +266,7 @@ enum Version {
#define CA_ItemAsKey "ITEM_AS_KEY" /* Supports the AsKey" mode */
#define CA_AdminAsKey "ADMIN_AS_KEY" /* Supports the AsKey" mode for Load/SaveAdminData */
#define CA_DeleteSyncSet "DeleteSyncSet"/* DeleteSyncSet ist fully implemented */
+#define CA_ResumeSupported "ResumeSupported" /* InsertMapItem is functional, defaults to "yes" if the method is available. Can be used to override its usage. */
#define CA_Error "ERROR" /* Capability error */
/* Predefined identifiers */