[haiku-development] Re: [GSoC proposal] IMAP FS - A few queries

  • From: Anshul Singhle <xashck@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 21 Apr 2011 18:49:42 +0530

Regarding the question of Cache Storage, I think its worthwhile to see how
popular email clients handle storage e.g Thunderbird -
As given in this link -
http://www.z-a-recovery.com/thunderbird-email-database.htm
From the article :
"Each Thunderbird mail folder is stored in two files named after this mail
folder name:

   - *File with no extension* stores email messages in the plain text
   format, one after one. This file is larger than the MSF index.
   - A corresponding (smaller) *.MSF file* contains mail folder indexes and
   preference data. Thunderbird figures out what part of the message to be
   displayed, the order of messages within a folder, and the like - all based
   on the .MSF file information. It is important to note that .MSF files do not
   contain any email messages and, all in all, are redundant. Thunderbird will
   rebuild .MSF files as needed if they are missing.

"
Let me also add how I understand the FS to be working - On mount, the FS
will create a directory structure and files from the information stored in
the cache. Now, whenever a file system operation is done, it basically looks
to the cache for what to display first (e.g. when a folder is opened to view
all mail files inside it) , if that information is not found in cache, (e.g
in the case the user is trying to view a mail whose contents have not been
viewed) it is retrieved and presented to the user(and optionally cached).

Now the question is how should the cache be implemented so that the
operations where information needs to be retrieved from the cache are
executed efficiently e.g when a directory is viewed and its contents need to
be presented, the FS will look for the index file in the cache, look for
files which are present in that folder and then parse through contents of
each (BFS)file and create (IMAPFS) files from those files, a potentially
expensive operation.
Maybe a better idea could be the way thunderbird does it? i.e. store an
index file for each folder? and a single file containing all mails in that
folder?
Also, it is important to note that my effort will be to make the cache
implementation as pluggable as possible so that it is possible to change the
implementation of cache without changing a lot of code.
Let me know you thoughts on this!

Other related posts: