[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coldsync-hackers] handling deletes in a conduit
On Wed, 4 Oct 2000, Jonathan Mark wrote:
> I have written a dump conduit for WebCalendar (a GPL Web calendaring
> system). When invoked by ColdSync it downloads the user's calendar
> entries from WebCalendar, and compares against the Palm datebook database.
> If any differ, then WebCalendar is updated to reflect the changes from the
> Palm.
>
> This works fine except for deletes. If you delete a datebook entry on the
> Palm, the dump conduit never sees it, so it doesn't know to delete it from
> WebCalendar.
Right. When the main sync (the generic conduit) runs, it sees that
a record has been deleted, and deletes it from the on-disk database.
Fetch and dump conduits are designed to be simple for simple
things; they're not all that powerful. Traditionally, with dump conduits,
you don't check for deleted records: you just nuke everything and rebuild
from what's in the PDB.
Alternately, you can read both the PDB and the WebCalendar
database, and compare them. This is a useful approach if you can't
recreate an entire WebCalendar record just from the information in the
PDB, or if you need to take special action to delete a WebCalendar record.
Then, the logic becomes something like:
load the PDB;
load the WebCalendar;
for each record R in the PDB, do:
if R exists in WebCalendar, then:
update the WebCalendar record;
mark it as seen;
else
create a new WebCalendar record;
mark it as seen;
fi
done
for each record W in the WebCalendar database, do:
if W is marked as seen, then
write it;
else
delete it;
fi
done
> >From looking at ColdSync, it seems that to be responsive to deletes, I
> should use a sync conduit. However I don't want to replace the
> functionality of GenericConduit.cc ... I want this to be run to keep the
> desktop database in sync with the Palm.
> So maybe I should derive a new class from GenericConduit for this purpose?
You could do that. However, at this point, it wouldn't be
easy. The generic conduit was written in C++ so that you could subclass
it, but it's still tightly integrated into ColdSync. There's currently no
support for conduits written in C++.
> Or perhaps my sync conduit should run in addition to GenericConduit?
> Or maybe I can handle deletes without using a sync conduit.
Yet a third solution would be to write a sync conduit that just
queries the Palm to find out which records have been deleted. This feels
like a hack, though. Plus, I'm not sure whether the Palm might get
confused by having two conduits ask it for modified records (but it should
be okay).
--
Andrew Arensburger Actually, these _do_ represent the
arensb@ooblick.com opinions of ooblick.com!
Generic Tagline V 6.01
--
This message was sent through the coldsync-hackers mailing list. To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body. For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.