Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 18FAA431FD0 for ; Mon, 24 Jan 2011 11:10:19 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RkKzrfEJkTm9 for ; Mon, 24 Jan 2011 11:10:18 -0800 (PST) Received: from market.scs.stanford.edu (market.scs.stanford.edu [171.66.3.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 59601431FB6 for ; Mon, 24 Jan 2011 11:10:18 -0800 (PST) Received: from market.scs.stanford.edu (localhost.scs.stanford.edu [127.0.0.1]) by market.scs.stanford.edu (8.14.3/8.14.3) with ESMTP id p0OJAHZx020012 for ; Mon, 24 Jan 2011 11:10:17 -0800 (PST) Received: from garage.uun.org.scs.stanford.edu (dm@localhost) by market.scs.stanford.edu (8.14.3/8.13.3/Submit) with ESMTP id p0OJAGHH007434 for ; Mon, 24 Jan 2011 11:10:16 -0800 (PST) X-Authentication-Warning: market.scs.stanford.edu: dm owned process doing -bs Date: Mon, 24 Jan 2011 11:10:16 -0800 Message-ID: From: dm-list-email-notmuch@scs.stanford.edu To: notmuch@notmuchmail.org Subject: Tag timestamps and synchronization User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/23.2 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: David Mazieres expires 2011-02-24 PST List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jan 2011 19:10:19 -0000 One of the features I would like to see from notmuch is an easier ability to synchronize tags across machines. At the very least, I would need either incremental dump and restore, or some way to communicate arbitrary tags to a local imap server that shares notmuch's maildir (much as notmuch currently syncs the standard tags), so that I synchronize two maildirs with a tool like offlineimap. As Carl pointed out to me in private email, there has been some previous discussion in the following thread: notmuch show id:87hbfnmiux.fsf@yoom.home.cworth.org Based on that thread, there seems to be some desire for notmuch to keep track of a per-message timestamp when the flags were last updated. This would allow much easier expiration for people who want the deleted tag. It would also allow incremental dump and restore of tags, which is exactly what I need to sync tags across servers with reasonable amounts of bandwidth. Metadata timestamps are one of those things that probably have a lot of different applications, so since Carl is considering a new database format for the next release anyway, perhaps it also makes sense to add a metadata change time for each messages. The timestamp would be included in "dump" output, and you could request a dump of changes since a particular time. On restore, you might have several options: - overwrite: always set the new tags and timestamp in the database to the value in the restore data. - update: always set the tags, but update the to the current time. - conditional T: update only if the message metadata has not been updated since time T. To sync flags, then you just need to keep track of the last time you synced with a particular server--call this time T. Do a dump since time T, upload to server, do a conditional restore for time T on server. Finally do a partial dump from time T on the server and an overwrite import on the client. (This policy makes changes on the server always override conflicting ones on the client--perhaps people want other policies, like union of the tags, etc.) Second, there seems to be some desire in that thread to sync with IMAP flags. This would be particularly great, but the easies way to do it is probably *not* to try to implement IMAP, but rather to use an existing IMAP server and just modify the maildir so that the IMAP server will pick up the flags. In the case of dovecot, the arbitrary tag format is very simple. Each maildir has a file called dovecot-keywords mapping numbers 0, 1, ... to keywords. Then mail file names contain lower-case letters for the flags they are marked with--0 => a, 1 => b, etc.--allowing up to 26 arbitrary tags for each maildir. One could probably sync to dovecot's maildir format relatively easily in a script given incremental dump and restore of tags. Or possibly notmuch could natively support dovecot as one of multiple back-end tag storage schemes. Having a static tag mapping in the .notmuch-config file would be much better than hard-coding flag2tag. However, I'm not sure it's sufficient. The reason is that if you ever completely delete a tag (e.g., you have "todo", and "meeting" tags and periodically have no messages in either categories in a given mail folder), then an IMAP server like dovecot might end up re-allocating the letters corresponding to those tags in a different order. Also, at least for dovecot, the flag mappings are per-folder, which you kind of want since you are limited to 26 non-standard tags, so global values might not work. I'm curious to hear people's thoughts/reactions? David