Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: gnus-sync.el v2
Date: Sat, 26 Jan 2013 23:27:56 -0500	[thread overview]
Message-ID: <878v7fqmgj.fsf@lifelogs.com> (raw)
In-Reply-To: <87y5hg8m49.fsf@lifelogs.com>

On Sun, 02 Dec 2012 11:17:10 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> I do (really really) want to rewrite gnus-sync.el to use native IMAP
TZ> commands instead of an external CouchDB installation, and at that time
TZ> will settle on a new, more robust format for flag and general data
TZ> storage.  I was supposed to get to that last month but my work
TZ> commitment was extended by a few weeks; the rewrite is at the top of my
TZ> TODO list.

TZ> I also asked Lars for help with the IMAP side but he hasn't been
TZ> available.  If you or anyone else wants to help, I need generic
TZ> functions that, given an IMAP mailbox, a string key, and an alist, can
TZ> store the alist under the key or delete the key (so basically I want a
TZ> hashtable implemented in an IMAP mailbox).  Writing those functions will
TZ> probably be 80-90% of the time I spend on the rewrite, so any help is
TZ> appreciated.  I used to have some understanding of imap.el, but the new
TZ> nnimap.el is a super wonderful mystery to me.

I spent time prototyping and thinking about this.

I still think the right approach is to use IMAP and nnimap.el for
recording the data, as Lars suggested originally.

I have realized that the whole gnus-sync.el structure is unnecessary.
Gnus already has synchronization built-in.  The dribble file is perfect
for synchronizing the data, and all the Gnus internals already write
group info and topics to the dribble file.

To implement a new IMAP-synchronized mode, we need to make every Gnus
instance behave like a slave Gnus, always consulting the dribble IMAP
group and saving back to it.

The configuration will be to simply set the dribble filename to an IMAP
folder and to set some gnus-sync variable to indicate perpetual slavery.

This has to be done in profiles, so you can have multiple connectivity
profiles but still share the marks and other information.

The format for the IMAP dribble group could be a series of messages in
the following formats:

1. set group info
subject = "gnus-group-set-info GROUPNAME"
from = PROFILE
body = (gnus-group-set-info ...)

2. set topology
subject = "setq gnus-topic-topology"
from = PROFILE
body = (setq gnus-topic-topology ...)

3. set group/topic parameters
subject = "gnus-topic-set-parameters GROUP-OR-TOPIC"
from = PROFILE
body = (gnus-topic-set-parameters ...)

4. set server parameters
subject = "PROFILE gnus-server-set-info SERVER"
from = PROFILE
body = (gnus-server-set-info ...)

All of the above are already entered into the dribble file at the right
time, with the right data, except for the profiles.

The sequence for saving each of the types above, given SUBJECT and BODY
and synchronization folder SYNC-FOLDER, and local connectivity profile
PROFILE:

1. create a new message with SUBJECT and BODY in SYNC-FOLDER

2. mark as 'read' all older messages with the same subject in FOLDER

Note that (2) must wait for (1) to succeed, but operates on all the
messages with SUBJECT except the newest one, so it's idempotent and will
not break if multiple clients do it at the same time.  Also, (2) can
fail and should be sent without waiting for a confirmation back.  It's
intended to speed up the read operations, but doesn't matter for the
save operations.

The sequence to synchronize:

1. find all the unread messages in SYNC-FOLDER.  Remember them in an
alist with cell format (SUBJECT . MESSAGE-ID).  This will be a small
alist.  For each distinct SUBJECT, only remember and load the latest
message.

2. ask the IMAP server to notify us when SYNC-FOLDER's UID changes and
do the usual dribble loading of new messages, skipping any message IDs
we have already remembered.  Are these notifications possible?

We should NOT synchronize the currently entered group; I think to avoid
user confusion we should simply ignore changes to it with a warning, and
save it on exit in the usual way.

Note that all the operations above for reading and saving are fast on
IMAP and are idempotent.

In synchronized mode, the newsrc file can still be saved and read, but
it will be overridden by whatever is in the SYNC-FOLDER.  So it's more
of a backup.

Let me know what you think about this proposal.  I think it's the right
solution, technically and practically.  Removing code (in this case
gnus-sync.el) in favor of the existing facilities is IMHO a good way to
simplify the user experience, reduce the maintenance burden, and improve
Gnus as a whole.

Ted




  reply	other threads:[~2013-01-27  4:27 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 14:20 how do I subscribe to a group as a string from code? Ted Zlatanov
2011-10-20 19:07 ` Tassilo Horn
2011-10-20 19:28   ` Ted Zlatanov
2011-10-20 20:11     ` Tassilo Horn
2011-10-20 21:19       ` Ted Zlatanov
2011-10-21 14:44 ` Steinar Bang
2011-10-24 13:19   ` gnus-sync.el v2 (was: how do I subscribe to a group as a string from code?) Ted Zlatanov
2011-10-24 20:48     ` gnus-sync.el v2 Steinar Bang
2011-10-25 13:02       ` Ted Zlatanov
2011-10-25 15:57         ` Steinar Bang
2011-10-25 16:23           ` Ted Zlatanov
2011-10-25 17:16             ` Steinar Bang
2011-10-25 17:22               ` Steinar Bang
2011-10-25 17:50               ` Ted Zlatanov
2011-10-25 18:10                 ` Steinar Bang
2011-10-27  7:28                 ` Katsumi Yamaoka
2011-10-27  9:42                   ` Steinar Bang
2011-10-27 11:23                     ` Steinar Bang
2011-10-27 17:36                     ` Ted Zlatanov
2011-10-27 19:40                       ` Ted Zlatanov
2011-11-03 21:09                         ` Steinar Bang
2011-11-03 21:43                           ` Ted Zlatanov
2011-11-03 22:37                             ` Steinar Bang
2011-11-04 12:19                               ` Ted Zlatanov
2011-11-04 20:52                                 ` Steinar Bang
2011-11-04 21:18                                   ` Ted Zlatanov
2011-11-05  7:53                                     ` Steinar Bang
2011-11-05  9:54                                       ` Ted Zlatanov
2011-11-05 10:45                                         ` Steinar Bang
2011-11-05 11:18                                           ` Steinar Bang
2011-11-05 13:03                                             ` Ted Zlatanov
2011-11-05 17:54                                               ` Steinar Bang
2011-11-05 17:59                                                 ` Adam Sjøgren
2011-11-05 18:53                                                   ` Steinar Bang
2011-11-05 13:00                                           ` Ted Zlatanov
2011-11-05 17:49                                             ` Steinar Bang
2011-11-05 18:57                                               ` Steinar Bang
2011-11-05 19:09                                                 ` Steinar Bang
2011-11-05 19:59                                                   ` Steinar Bang
2011-11-05 20:09                                                     ` Adam Sjøgren
2011-11-05 22:13                                                       ` Steinar Bang
2011-11-05 22:35                                                         ` Adam Sjøgren
2011-11-06 13:13                                                         ` Ted Zlatanov
2011-11-06 13:34                                                           ` Steinar Bang
2011-11-06 14:07                                                             ` Ted Zlatanov
2011-11-06 19:23                                                               ` Steinar Bang
2011-11-06 20:49                                                                 ` Steinar Bang
2011-11-06 21:29                                                             ` Steinar Bang
2011-11-07 19:55                                                               ` Steinar Bang
2011-11-07 20:08                                                                 ` Steinar Bang
2011-11-09  0:52                                                                   ` Ted Zlatanov
2011-11-09  9:27                                                                     ` Steinar Bang
2011-11-09 14:17                                                                       ` Ted Zlatanov
2011-11-09  0:47                                                                 ` Ted Zlatanov
2011-11-09  9:31                                                                   ` Steinar Bang
2011-11-09 14:15                                                                     ` Ted Zlatanov
2011-11-13  7:51                                                                       ` Steinar Bang
2011-11-09  0:45                                                               ` Ted Zlatanov
2011-11-09  9:32                                                                 ` Steinar Bang
2011-11-06  7:22                                                     ` Steinar Bang
2011-10-29 19:02                       ` Steinar Bang
2011-10-31 17:25                         ` Ted Zlatanov
2011-10-25 17:02           ` Steinar Bang
2011-11-03 22:43     ` Lars Magne Ingebrigtsen
2011-11-04  8:09       ` Steinar Bang
2011-11-04 12:20       ` Ted Zlatanov
2012-12-02 10:13     ` Andreas Schwab
2012-12-02 10:19       ` Andreas Schwab
2012-12-02 16:17         ` Ted Zlatanov
2013-01-27  4:27           ` Ted Zlatanov [this message]
2013-01-27  6:31             ` Eric S Fraga
2013-01-27 16:35             ` Steinar Bang
2012-12-03  9:50       ` Steinar Bang
2012-12-03 10:30         ` Matt Ford

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=878v7fqmgj.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=ding@gnus.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;
as well as URLs for NNTP newsgroup(s).