From: Edward Betts Date: Wed, 12 Nov 2014 21:37:02 +0000 (+0000) Subject: Synchronising mail and notmuch tags between machines X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b9dd121108cbb9f676ced3b95bca9be5eaffddbc;p=notmuch-archives.git Synchronising mail and notmuch tags between machines --- diff --git a/9c/6e1404299b9bbd7bb9035ff80eeb96fc0fce87 b/9c/6e1404299b9bbd7bb9035ff80eeb96fc0fce87 new file mode 100644 index 000000000..76d74e803 --- /dev/null +++ b/9c/6e1404299b9bbd7bb9035ff80eeb96fc0fce87 @@ -0,0 +1,90 @@ +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 1F67D431FBF + for ; Wed, 12 Nov 2014 14:14:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 DcnNd+wn+8tm for ; + Wed, 12 Nov 2014 14:14:12 -0800 (PST) +X-Greylist: delayed 2218 seconds by postgrey-1.32 at olra; + Wed, 12 Nov 2014 14:14:12 PST +Received: from 4angle.com (4angle.com [82.145.46.9]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D0E97431FAF + for ; Wed, 12 Nov 2014 14:14:12 -0800 (PST) +Received: from cpc19-cmbg14-2-0-cust212.5-4.cable.virginm.net ([86.6.30.213] + helo=x230) + by 4angle.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) + (Exim 4.82) (envelope-from ) id 1XofbB-0002K8-Ue + for notmuch@notmuchmail.org; Wed, 12 Nov 2014 21:37:10 +0000 +Received: from edward by x230 with local (Exim 4.84) + (envelope-from ) id 1Xofb4-00066L-Kg + for notmuch@notmuchmail.org; Wed, 12 Nov 2014 21:37:02 +0000 +Date: Wed, 12 Nov 2014 21:37:02 +0000 +From: Edward Betts +To: notmuch@notmuchmail.org +Subject: Synchronising mail and notmuch tags between machines +Message-ID: <20141112213702.GA22214@x230> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 12 Nov 2014 22:14:21 -0000 + +I've written some code to synchronise mail between my server and laptop. I +have notmuch running on both machine, whenever mail is added to notmuch, it is +tagged as needing to be copied to the other machine, the tags are +sync-to-laptop and sync-to-server. Whenever I modify the tags on a mail I'm +careful to add the sync tag. My mail reader is configured to add the sync tag +whenever I make any changes to a mail. + +Here is the code: + +https://github.com/EdwardBetts/notmuch-pushy/ + +The synchronise code opens each database and checks for messages that need to +be synchronised, the tags are copied to the other database, if the mail is new +then content is copied as well. Then the sync tag is removed from the source +message. + +I'm using a Python RPC module called pushy, it provides a simple way to +connect two python interpreters on different machines. Pushy provides proxy +objects to access remote objects as if they are local. These means I can +access the local and remote notmuch databases from within the same piece of +code. All the communication happens over ssh, and pushy even provides methods +for copying files between the machines. + +https://pythonhosted.org/pushy/ +https://github.com/pushyrpc/pushy + +My main todo item is reducing the amount of time that the write lock is held. +I should copy messages back and forth before grabbing the write lock to update +the tags. + +It would be helpful if the notmuch would always add the sync tag when a +message was modified, unless the sync tag is explicitly being removed. That +way there is no risk of me forgetting to add the sync tag when I'm modifying +tags using the command line tools. +-- +Edward.