GNOME Bugzilla – Bug 424744
Erode Camel's dependency on libedataserver
Last modified: 2008-05-07 02:19:48 UTC
One of the tasks I'd like to focus on during the 2.11 development cycle is eroding Camel's dependency on libedataserver, with the ultimate (probably post-2.12) goal of either eliminating or reversing the dependency. Some progress in this direction has already been made. EMutex and EThread, upon which Camel used to depend heavily, have been superseded by equivalent data structures in GLib (bug #356177, bug #362638). Camel still uses EMsgPort for its file descriptor feature, but Evolution will soon have no need for it (bug #362638). Several structures in libedataserver that optimize memory usage (used by both Camel and Evolution) may be able to be replaced by equivalent structures in GLib (bug #363695). In addition, there are several modules in libedataserver that I think would make sense to move to Camel, either because the module is only used by Camel or because it seems to be a better fit for Camel than libedataserver. Here are ones I think are obvious candidates for moving to Camel: EMsgPort -------- Once bug #362638 and bug #415891 are accepted, Evolution will no longer use EMsgPort. Camel still uses EMsgPort for it's pipe feature, which allows you to cancel a blocking I/O operation when a message arrives on a dedicated "cancellation" EMsgPort. I propose deprecating EMsgPort and introducing an equivalent data structure in Camel (CamelMsgPort). e-iconv ------- Deprecate the e_iconv_* functions in libedataserver and introduce equivalent camel_iconv_* functions in Camel. Camel depends heavily on these functions, and I think it makes more sense for this functionality to live in Camel. Evolution's Mail component also uses them, as does a few custom widgets in Evolution. But it would be a simple matter to adapt to the change; just switch the "e" prefix to "camel". e-trie ------ This data structure is only used by Camel. md5-utils (possibly) --------- This module is primarily used by Camel. The only other use is in e-dbhash.c, which has several calls to md5_get_digest(). I suggest we deprecate but not remove the MD5 API in libedataserver so that e-dbhash can continue to use it, and introduce an equivalent API in Camel. Then once the Camel -> libedataserver dependency has been reversed, remove the MD5 API in libedataserver and have e-dbhash use the Camel MD5 API. These changes would not completely eliminate Camel's dependency on libedataserver, but they would get us significantly closer to the goal.
harish / srini / varadhan - Any thoughts? (And what's harish's Bugzilla email at the moment?)
Tinymail's camel-lite has some work for getting-rid-of the dependency on libedataserver. You can of course take a look at which items I needed to compile to create a static library of libedataserver that only has the things Camel needs: pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ ls *c *h e-data-server-util.c e-iconv.h e-msgport.c e-sexp.h e-trie.c md5-utils.c e-data-server-util.h e-memory.c e-msgport.h e-time-utils.c e-trie.h md5-utils.h e-iconv.c e-memory.h e-sexp.c e-time-utils.h libedataserver-private.h pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ ls -alh libedataserver-1.2.a -rw-r--r-- 1 pvanhoof pvanhoof 87K 2007-05-09 20:37 libedataserver-1.2.a pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ strip libedataserver-1.2.a pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$ ls -alh libedataserver-1.2.a -rw-r--r-- 1 pvanhoof pvanhoof 44K 2007-05-13 13:58 libedataserver-1.2.a pvanhoof@schtrumpf:~/repos/tinymail/trunk/libtinymail-camel/camel-lite/libedataserver$
Created attachment 89019 [details] [review] Proposed patch for evolution-data-server This patch implements the proposal in comment #0. Specifically, it deprecates all or part the following files: libedataserver/e-iconv.[ch] libedataserver/e-msgport.[ch] (just the EMsgPort API) libedataserver/e-trie.[ch] libedataserver/md5-utils.[ch] And adds the following files: camel/camel-iconv.c (header already exists) camel/camel-msgport.[ch] camel/camel-trie.[ch] camel/camel-md5-utils.[ch] I also applied some cosmetic changes to the new Camel headers.
Here's an additional hunk that got left out of the patch in comment #3. I'll merge these if I wind up having to post a revised patch. Index: camel-session.h =================================================================== --- camel-session.h (revision 7789) +++ camel-session.h (working copy) @@ -27,12 +27,11 @@ #ifndef CAMEL_SESSION_H #define CAMEL_SESSION_H 1 +#include <camel/camel-msgport.h> #include <camel/camel-object.h> #include <camel/camel-provider.h> #include <camel/camel-junk-plugin.h> -#include <libedataserver/e-msgport.h> - #define CAMEL_SESSION_TYPE (camel_session_get_type ()) #define CAMEL_SESSION(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession)) #define CAMEL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SESSION_TYPE, CamelSessionClass)) @@ -173,7 +172,7 @@ struct _CamelSessionThreadOps { }; struct _CamelSessionThreadMsg { - EMsg msg; + CamelMsg msg; int id;
Created attachment 89022 [details] [review] Proposed patch for evolution This patch makes Evolution use the camel-iconv API instead of e-iconv, which the evolution-data-server patch deprecates.
The patch does not contain the new files, it seems
Created attachment 89454 [details] [review] Port of the patch to Tinymail's Camel This is the port of the patch to Tinymail's camel-lite. Note that I can't test this without the new files, mbarnes. Waiting for those :)
Changing the status of your patch to needs-work, Matthew (for adding the files)
Created attachment 89475 [details] [review] Revised patch for evolution-data-server Gah, sorry about that. This patch includes the new Camel files.
Will take a look at this patch soon (to integrate with Tinymail's camel-lite). Bookmarked.
GLib 2.16 will be getting support for MD5 checksums, so that should clear up the md5-utils issue. I hope we can start moving forward on this for Evolution 2.24. The plan I've laid out should avoid any API/ABI breakage.
Bug #518710 has a patch for moving to GLib 2.16's checksum API.
Created attachment 108698 [details] [review] Revised patch for evolution-data-server Revised patch for Evolution-Data-Server 2.23.1. With the MD5 issue resolved, this patch simply moves a few data structures from libedataserver to camel, where they belong. Introduces Deprecates ------------- ------------- camel-iconv e-iconv CamelMsgPort EMsgPort CamelTrie ETrie
Created attachment 108699 [details] [review] Revised patch for evolution Revised patch for Evolution 2.23.1.
I guess I should've been CC'ing Sankar all along. Sankar, any thoughts on this?
Bug #522639 provides a bit more motivation for this effort.
Committing the remaining patches since I haven't heard any objections to this over the past year. There's still more work to be done in severing Camel's dependence on libedataserver. This bug was just for the low-hanging fruit. I'll deal with the rest in separate bugs. Committed to trunk: evolution revision 35474 evolution-data-server revision 8761