On Thu, 2010-06-17 at 13:48 +0200, Patrick Ohly wrote:
In another context, say @xmlrpc, we define a sources that accesses
different data via some other backend, like the XMLRPC interface. Let's
assume we have one source defined, like "calendar".
Now we configure one peer "xmlrpc" in the @default context:
syncURL = local
peerIsClient = 1
[calendar]
URI = calendar@xmlrpc
While this is a valid approach, the comment made further down about
choosing a log directory for the peer was based on the assumption that
all peer URIs are in the same context. Another drawback of the proposal
above is that @xmlrpc would have to be repeated for every single source
URI.
Therefore I propose to use the following simpler scheme instead:
syncURL = local://@xmlrpc
peerIsClient = 1
[calendar]
URI = calendar
[addressbook]
URI = addressbook
...
Such a config can be created easily with
syncevolution --configure --template "SyncEvolution Client" \
--sync-property syncURL=local://@xmlrpc \
xmlrpc
Note 1: the URIs do not have to match the name of the source.
"calendar@default" could be synchronized with a
"work-calendar@xmlrpc"
source. The name of the config ("xmlrpc") also does not have to match
the name of the context ("@xmlrpc").
Note 2: peerIsClient = 0 is not supported for syncURL = local://. This
simplifies the implementation a bit. It would be possible to ignore
peerIsClient, but I prefer to enforce a correct configuration, just in
case that later on support for peerIsClient = 0 gets added.
Currently I favor the idea of using two processes, mostly because it
requires less rewriting of code.
I have thought some more about this. The first question is about the IPC
mechanism. I considered going for D-Bus with direct communication, but
that would turn out to be a hell lot of work to set up and use.
Compiling the syncevolution command line tool without D-Bus would
disable local sync.
Therefore I'll write my own simple message passing via pipes. A
message/response style with one message pending at any time is all that
is needed, so D-Bus would be overkill.
The second question is about fork/exec or just a fork, with the second
session running inside the same binary. fork/exec gives the second
process a clean environment, regardless whether it was started inside
the syncevolution command line tool or the syncevo-dbus-server. But it
is harder to set up (need to pass parameters via env or command line,
need to determine what to exec, possibly adding a separate binary to the
distribution), so currently I favor a quick-and-dirty solution using
fork without exec.
Further issues:
* Slow sync detection does not work when sync is started on the server
side, which is what we are using. Our client side will detect it,
but it'll not be able to report this properly to the server without
additional work.
* Error reporting in general is tricky. If an error occurs on the client
side, the server will only see very unspecific error codes reported
by the Synthesis engine for each source and the overall sync.
I think this needs to be solved either way, so I prefer to keep the
configuration so that the peer configuration is created with
peerIsClient = 1.
* Naming of sources in the synccompare and result overview is
awkward ("local" vs. "remote") when both sides of the sync
work with local data; as long as we set up the server with
local data and the other side with backends for remote data
(XMLRPC, CalDAV), the naming should be fine.
* Creating contexts without any peer is currently rejected. That is
needed for creating the target context of the client. Here's how
it should work, now using the file backend instead of XMLRPC:
syncevolution --configure --template "SyncEvolution Client" \
--sync-property syncURL=local://@files \
testfiles
syncevolution --configure \
--source-property evolutionsource=file:///tmp/test_files_calendar \
--source-property type=file:text/calendar:2.0 \
foo@files calendar
syncevolution --configure \
--source-property evolutionsource=file:///tmp/test_files_addressbook \
--source-property type=file:text/vcard:2.0 \
foo@files addressbook
Instead one has to add a dummy "--template SyncEvolution" and turn @files into
foo@files.
--
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.