Re: Usage of Tinymail by Multiple Applications

On Wed, 2007-11-28 at 16:21 +0530, Maheswari Govindaraju wrote:
> Hi all,
> One basic doubt.
> Could somebody clarify regarding the access of Tinymail by multiple
> applications.
> From the implementation perspective, Tinymail seems to do a mutex
> lock/unlock before every folder access. 

> So can Multiple applications access a specific folder simultaneously?
> Or can multiple applications use Tinymail functionalities?

If you would want multiple applications to share one socket (one
connection) with the IMAP server, then you will have to use Tinymail as
API in a service application that exposes a remote API. You could for
example use D-BUS as IPC for this.

I recommend using the _async functions in this case, and making your
remote API asynchronous too (a call will immediately return, an event is
placed on D-BUS's bus as soon as the call is finished and can be catched
by the client applications consuming the remote API who are interested
in this).

If you don't care how many sockets (connections) the computer makes,
then you can simply make multiple applications and link with the
Tinymail libraries multiple times. Scheduling will be done by your
operating system and the locks will only happen per process (they are no
file locks, like flock() is, they are locks that prevent multiple
threads in a process from entering the same context.

> Please advise. I couldn't find any documentation in Tinymail site
> regarding these points. 

Note that POP servers don't allow multiple connections for the same
user. If you would like multiple applications to use one POP account,
the design will have to be a "Tinymail is used to make a service, the
applications consume that service" style. 

For IMAP this matters less, as you can make as much connections per user
to an IMAP server as you want.

Note that Tinymail does not allow you to have the same cache_dir and yet
have multiple folders active. There's no file locking so if you are
going to run multiple applications, then make sure that each of them
have different cache_dir locations. For example ~/.app_name/mailcache

You can define the cache_dir by implementing your TnyAccountStore.

Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]