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

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 08 Apr 2011 14:05:51 +0200

On 2011-04-08 at 13:31:23 [+0200], Anshul Singhle <xashck@xxxxxxxxx> wrote:
> > 1) The IMAP FS needs to support the regular "remove" operation on file
> entries. How this is implemented does not matter, as long as the result of
> this operation is that the email is gone from the server. This operation is
> not supposed to be revertable.
> 
>  "removing" a file from a server is a two step process: AFAIK you cannot
> simply delete a mail from an IMAP server, you have to mark it for deletion
> and then EXPUNGE. See:
> http://deflexion.com/2006/05/imap-way-of-deleting-message . It says here
> that EXPUNGE is an expensive operation and it is recommended that users
> should not EXPUNGE frequently. Therefore, on deletion it would be better  to
> move the file to "trash" and also set the /Deleted flag.

If you read further, moving the file to the trash is also considered expensive.

> There is no comment
> on how expensive an EXPUNGE operation is. Of course doing it the way you
> described is possible and definitely make more sense however it *may* cause
> performance issues.

If servers, as they used to do traditionally, still use the Berkeley mailbox 
format (concatenating emails in a single flat file), removing a mail is 
expensive 
(O(n)), because all following mail data need to be moved to close the "hole" 
the 
deleted mail leaves. (Since that isn't an atomic file system operation, the 
server might even back the whole file up first to be able to recover a 
consistent 
state in case of a crash.) Setting the "deleted" flag of a mail is probably 
just 
a single write that doesn't change the file size. I suppose moving a mail to 
another folder consists of a relatively cheap append operation to the target 
mailbox file and an expensive remove from the source mailbox file.

>  >3) The IMAP FS needs to expose the server's Trash folder (note that it may
> be named differently) as "trash" folder at it's root directory and it shall
> not display it under its real name (like "deleted mail" or whatever).
> 
> This might cause a problem. Who will set the trash folder? the user? perhaps
> when the user is setting up his account we can check for a folder named
> "Trash" and if it doesn't exist, we can ask the user to specify the trash
> folder.
> 
> Also regarding your point about "strikethrough mails". This should not cause
> problems if all the /Deleted mails are in the Trash folder. They wouldn't
> interfere with your usual mails.
> 
> The IMAP mechanism for deletion is messy and causes problems across clients,
> See:
> http://forums.mozillazine.org/viewtopic.php?f=28&t=89572&start=0&st=0&sk=t&sd=a.

As the deflexion.com article also mentions, many IMAP clients allow the exact 
behavior of deleting mails to be configured. We should support that, too. Then 
the user can choose a setup that works best with their other clients.

CU, Ingo

Other related posts: