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 0B375431FBC for ; Wed, 17 Feb 2010 20:38:18 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 tests=[BAYES_50=0.001] autolearn=ham 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 R+eSkGMl2PtE for ; Wed, 17 Feb 2010 20:38:17 -0800 (PST) Received: from qw-out-1920.google.com (qw-out-1920.google.com [74.125.92.150]) by olra.theworths.org (Postfix) with ESMTP id 45BBE431FAE for ; Wed, 17 Feb 2010 20:38:17 -0800 (PST) Received: by qw-out-1920.google.com with SMTP id 5so1085717qwc.32 for ; Wed, 17 Feb 2010 20:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:subject:from:to :date:message-id:user-agent:content-transfer-encoding; bh=+z0xtkmvIupPmJMHvJ5LPprzD5ghU4fZNSQMu6naGAA=; b=b8pABbBbhb1dIsZxNRumml4maJU/DnntQ4phbgqEC+X1myLrnZLfxmdR+qyu2n9wPQ hNG45fGAgn4XoebceENWwk8M7Sqj9MRX2K0pDG/V4/VCEi5TS4tEQvumTh+CBIka7sy2 yamx7HtsOj7TT0fnH+c/ouVt9aBh+j84zw1ug= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:date:message-id:user-agent :content-transfer-encoding; b=plinDTioCILE26rLDobAP6h9usmE1UX6MqULtoZcpqjS+gzjWAd5AaN52cHHotfyK1 ggBzv5/QCoikeESDW/g/K+qNz+nIGKLAGznTEYrNjaHTR3O9UpVXrMWA3L0HI1ia23Xs MCff4EiFKxJ7DoZFM1nsWZesAEURqFSF2bygo= Received: by 10.224.140.144 with SMTP id i16mr2235066qau.149.1266467896674; Wed, 17 Feb 2010 20:38:16 -0800 (PST) Received: from localhost (pool-96-236-125-203.spfdma.east.verizon.net [96.236.125.203]) by mx.google.com with ESMTPS id 23sm6430113qyk.3.2010.02.17.20.38.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Feb 2010 20:38:15 -0800 (PST) Content-Type: text/plain; charset=UTF-8 From: Ben Gamari To: notmuch Date: Wed, 17 Feb 2010 23:38:13 -0500 Message-Id: <1266467878-sup-1425@ben-laptop> User-Agent: Sup/git Content-Transfer-Encoding: 8bit Subject: [notmuch] Fwd: Re: nested tag trees (was: Mail in git) 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: Thu, 18 Feb 2010 04:38:18 -0000 --- Begin forwarded message from martin f krafft --- From: martin f krafft To: Ben Gamari Date: Wed, 17 Feb 2010 22:46:13 -0500 Subject: Re: nested tag trees (was: [notmuch] Mail in git) You ought to have sent to the list, and I want to send mine there too, so please give permission. also sprach Ben Gamari [2010.02.18.1620 +1300]: > This is a very good point. From what I've read about the database > format, I can't think of any way that reverse dependencies could be > easily found, unfortunately. If there really is no way to do this, then > we could have a problem. I'm not sure rewriting tens of megabytes > everytime you receive a mail message is acceptable. You would not need to do that, since the messages don't change, and thus their blobs remain the same. However, for every manipulation of a message, you would need to iterate *all* tag trees (O(n)) and update the ones referencing the message (also O(n)). The entire process will still be O(n) per message, and O(m×n) for all: messages=[list of messages] add_tags=[list of tags to add] remove_tags=[list of tags to remove] tagtrees=[all tag trees] trees_to_update=[] for t in remove_tags: if intersection(t.tree.children, messages): T = new_tree(t.name) write_tree(T, t.tree.children - messages) write_tree(t.tree, []) t.tree = T for t in add_tags: t.tree = new_tree(t.name) rewrite_tree(t.tree, messages) This can probably be further optimised, but still: it's not quite as nice as enumerating all parents of a message in O(1) time (which would still result in O(m×n)). --- End forwarded message ---