Tinymail workshop Sergio Villar Senín English translation by Arien What is tinymail? ----------------- * Started in January 2006 by Philip Van Hoof * Pronounced as “tinny-mail” * Framework for development of email applications * Oriented towards portable devices - Nokia N770, N800 - One Laptop Per Child - GPE * Tinymail is LGPL Tinymail is a framework ----------------------- * tinymail ISN’T an email client * Offers the basic components of an email client (MUA) - A client in 90 lines of Python! * Uses Camel as default implementation * tinymail supports: - IMAP with Lemonade. Push e-mail. - POP3 - SMTP, sendmail - Local storage - Offline mode Why is tinymail needed? ----------------------- * Evolution, Thunderbird are OK, but... - Consume a lot of resources - Desktop interfaces * Portable devices - Few resources - Very different architectures - Very different interfaces * We need something more generic Memory use in tinymail ---------------------- * How much memory can an email program consume? - Summary information - 4 bytes x 20 fields x 20.000 emails ≈ 1.5MB (in pointers!!!) [graph] Memory use by Evolution when loading a folder with 30000 emails Memory use in tinymail (2) -------------------------- * mmap() - Memory-mapping a file on POSIX systems - Efficient memory use * No copies to user space * Shared memory between multiple processes - Faster access * Accessing contents through simple pointers. No syscalls * Grouping multiple modifications in a single I/O operation - Demand paging. If it’s not needed, it’s not loaded - Not a panacea: more page faults Memory use in tinymail (3) -------------------------- * Okay, so how much memory does tinymail use? - Administrative data structures ≈ several hundreds of KB - Downloading summaries for the first time forces having all the data in memory: * Optimization: every 1000 items the data are dumped to disk and a new mmap-ed file is loaded * And graphically? Memory use in tinymail (4) -------------------------- [graph] * Memory use when loading the contents of folders with: 700, 50000, 5000, 500, 40000, 30000, 3000, 2000, 200, 10000, 1000, and 100 emails for the first time. * Source: http://tinymail.org/trac/tinymail/wiki/MemoryStats What is tinymail like? ---------------------- * Two-layer architecture - service layer - user interface layer * Design - Based on GObject and GTypeInterface - Design patterns: strategies, proxies... - Extensive use of interfaces - Possible to re-implement almost everything - Possible to inherit from almost everything - Efficient use of Streams Tinymail architecture --------------------- * Service layer - libtinymail: interfaces of the service layer - libtinymail-camel: implementation using Camel * User interface layer - libtinymailui: interfaces of the user interface layer - libtinymailui-gtk: implementation using Gtk+ * Platform dependent components - libtinymail-gnome-desktop: GNOME - libtinymail-maemo: Maemo - libtinymail-olpc: OLPC - libtinymail-gpe: GPE Some design ----------- * Design of email accounts [image] Some design (2) --------------- * Design of folders and messages [image] Some code --------- * How to create a plain text message [example] More information ---------------- * tinymail - Web: http://tinymail.org/ - Trac: http://tinymail.org/trac/tinymail/ - Mailing lists: mailto:tinymail-devel-list@gnome.org - IRC: #tinymail on GimpNET * Projects using tinymail - Modest: http://modest.garage.maemo.org/ By the way... ------------- * Any questions? Pitching in ----------- * tinymail core tasks - http://tinymail.org/trac/tinymail/wiki/DesignAndCoding * Gtk+ tasks - Adding drag-and-drop to the demo - Support for the GtkUIManager * Qt tasks - Support for GMainloop in KDE 4? - Adding compilation dependencies - libtinymail-kde-desktop