Hello!
The documentation for a comparescript describes return codes for the
cases where the two items are equal, but one is more recent than the
other:
script returning 0 if target equals reference, 1 if target is
newer than reference, -1 if target is older than reference,-999
if items are not comparable or not equal but age of items is not
known.
I have written a compare script which checks UID/RECURRENCE-ID to
determine matching items and then looks at LAST-MODIFIED to determine
which one is more recent:
if (TARGET.UID == REFERENCE.UID &&
TARGET.ORIGSTART == REFERENCE.ORIGSTART) {
RES = COMPARE(TARGET.DMODIFIED, REFERENCE.DMODIFIED);
} else {
RES = -999;
}
Now I am using that in a slow sync, which gives me a RES of 1:
[2011-06-14 14:35:38.148] Compared
[LOC=20060406T211449Z-4562-727-1-63@gollum-rid,REM=] with
[LOC=,[email protected]] (eqMode=2), cmpres=1
That's as expected. The unexpected part is that the engine keeps
comparing the incoming items against the complete local database and in
the end gives up.
I found that TStdLogicDS::getMatchingItem() only accepts a match if the
result is exactly zero:
if ((*pos)->compareWith(
*syncitemP,aEqMode,this
#ifdef SYDEBUG
,PDEBUGTEST(DBG_DATA+DBG_MATCH+DBG_EXOTIC) // only show comparison if
exotic AND match is enabled
#endif
)==0)
// items match in content
// - check if item is not already matched
I'm at a loss right now. Is a comparescript expected to always return
zero for a match and skip the age comparison?
When comparing this against the case where the standard logic is used, I
see that the initial comparison in COMPAREFIELDS() yields 0:
[2011-06-14 14:55:10.796] Compared
[LOC=20060406T211449Z-4562-727-1-63@gollum-rid,REM=] with
[LOC=,[email protected]] (eqMode=2), cmpres=0
After finding this match, the comparescript is invoked again, this time
apparently to determine the relative age:
[2011-06-14 14:55:10.799] Compared
[LOC=,[email protected]] with
[LOC=20060406T211449Z-4562-727-1-63@gollum-rid,REM=] (eqMode=5), cmpres=1
So it seems to me that a custom compare script must check the
TEqualityMode aEqMode: if >= 5 == eqm_nocompare (?), then do age
comparison, otherwise only check for match?
Is that really intentional? I don't find anything in the documentation
about this.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis