Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Horacio Sanson <hsanson@gmail.com>
To: Sup developer discussion <sup-devel@rubyforge.org>
Subject: [sup-devel] Heliotrope limitations for backward synchronization, , ,
Date: Mon, 23 May 2011 23:42:16 +0900	[thread overview]
Message-ID: <BANLkTikfZiyezXe3tF-VVgsEWjZb33EEVg@mail.gmail.com> (raw)

Now that I have GMail to Heliotrope initial synchronization (first
time) and incremental (new messages) synchronization working in my
script I started working on Heliotrope to GMail synchronization.
Unfortunately I found some difficulties to achieve this.

I am following rfc4549.txt and the client-to-server synchronization
says verbatim:

     c) "Client-to-server synchronization": for each IMAP "action" that
      was pending on the client, do the following:

      1) If the action implies opening a new mailbox (any operation that
         operates on messages), open the mailbox.  Check its UID
         validity value (see Section 4.1 for more details) returned in
         the UIDVALIDITY response code.  If the UIDVALIDITY value
         returned by the server differs, the client MUST empty the local
         cache of the mailbox and remove any pending "actions" that
         refer to UIDs in that mailbox (and consider them failed).  Note
         that this doesn't affect actions performed on client-generated
         fake UIDs (see Section 5).

      2) Perform the action.  If the action is to delete a mailbox
         (DELETE), make sure that the mailbox is closed first (see also
         Section 3.4.12 of [RFC2683]).


Seems simple to do but Heliotrope currently does not store/provide
enough information to implement this like:

 1)  Account and Mailbox information of messages.
  2) Heliotrope msg_id to GMail UID map.
  3) Per mailbox action FIFO queues.


Each action performed via Heliotrope (add label, remove label, state
change, delete) should be stored in some kind of FIFO associated to
the an account/mailbox pair. For example adding a label to a message
in my personal account's inbox would add an action like:

   label_add <label> <msg_id>

where label_add is the action, <label> the action parameter and
<msg_id> the message ID as seen by Heliotrope.  Then during
synchronization for an account I would iterate over all mailboxes
associated to the account and for each one I would replay the same
actions stored in the mailbox FIFO in the GMail server. Once an action
succeeds on the GMail side I  pop it out of the FIFO and continue with
the next action. Using the msg_id to UID map I can determine to what
message on the GMail side the action should be performed on.

Now how to implement these features? One way could be using the extra
parameters hash in the Heliotrope::Index::message_add method to store
the messages account, mailbox and UID's of each message when they are
added to Heliotrope index. This would also require a way to query this
information.

Another way would be to use special labels to mark mailboxes and
accounts. And add some new query formats to get all mailboxes for a
certain account and the FIFO actions of the mailbox.

Finally I am more inclined to keeping a separate Index/Store for each
account and access them via REST URLs like:

   POST  /<account>                                              #
Create new account Index/Store files
   POST   /<account>/<mailbox>                       # Create new
mailbox in account. Implemented using special labels?
   GET     /<account>/mailboxes                        # List all
mailboxes for account
   GET     /<account>/<mailbox>/action          # Get the next pending
action on mailbox
   DELETE /<account>/<mailbox>/action       # Delete next pending
action on mailbox
   POST  /<account>/<mailbox>/message     # Add new message to an
account/mailbox
   GET    /<account>/<mailbox>/message     # Get all messages from
account/mailbox

This of course is how I think  IMAP offline synchronization could be
done. If there are other ways to do this I am open to suggestions.

regards,
Horacio Sanson
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


             reply	other threads:[~2011-05-23 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 14:42 Horacio Sanson [this message]
2011-05-23 22:23 ` Vivien Didelot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTikfZiyezXe3tF-VVgsEWjZb33EEVg@mail.gmail.com \
    --to=hsanson@gmail.com \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox