backends: merge with incoming data by default

All backends except for EDS replaced local data wholesale with an
incoming update, even if that update came from a peer which did not
store all properties. The EDS backend had already been configured
earlier to always merge remote and local data before writing it back.

Instead of updating each backend individually it makes more sense to
make the more intelligent (and more expensive) merging the default in
backends derived from SyncSourceSerialize/TrackingSyncSource. Backends
which do not want it can remove
"<updateallfields>true</updateallfields>" from
SynthesisInfo::m_datastoreOptions.
This commit is contained in:
Patrick Ohly 2012-06-15 09:57:23 +02:00
parent 5bc01e7990
commit 5014f9b105
3 changed files with 8 additions and 2 deletions

View File

@ -57,7 +57,6 @@ class EvolutionSyncSource : public TrackingSyncSource
{
TrackingSyncSource::getSynthesisInfo(info, fragments);
info.m_backendRule = "EVOLUTION";
info.m_datastoreOptions += " <updateallfields>true</updateallfields>\n";
}
protected:

View File

@ -620,6 +620,11 @@ void SyncSourceSerialize::getSynthesisInfo(SynthesisInfo &info,
// default remote rule (local-storage.xml): suppresses empty properties
info.m_backendRule = "LOCALSTORAGE";
// We store entire items locally and thus have to make sure that
// they are complete by having the engine merge incoming and local
// data.
info.m_datastoreOptions += " <updateallfields>true</updateallfields>\n";
if (type == "text/x-vcard") {
info.m_native = "vCard21";
info.m_fieldlist = "contacts";

View File

@ -1390,7 +1390,9 @@ class SyncSourceBase : public Logger {
*
* One example is adding <updateallfields>: this is necessary
* in backends which depend on getting complete items (= for example,
* vCard 3.0 strings) from the engine.
* vCard 3.0 strings) from the engine. Note that any source
* derived from SyncSourceSerialize (= the majority of the backends)
* have this set by default.
*/
std::string m_datastoreOptions;