Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 805C19690 for ; Thu, 29 Dec 2011 00:33:51 +0000 (UTC) Received: (qmail 30864 invoked by uid 500); 29 Dec 2011 00:33:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 30824 invoked by uid 500); 29 Dec 2011 00:33:49 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 30816 invoked by uid 99); 29 Dec 2011 00:33:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 00:33:49 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gcdcu-couchdb-user@m.gmane.org designates 80.91.229.12 as permitted sender) Received: from [80.91.229.12] (HELO lo.gmane.org) (80.91.229.12) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 00:33:41 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rg3vp-0000S6-W4 for user@couchdb.apache.org; Thu, 29 Dec 2011 01:33:18 +0100 Received: from c-76-28-40-19.hsd1.vt.comcast.net ([76.28.40.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Dec 2011 01:33:17 +0100 Received: from tzz by c-76-28-40-19.hsd1.vt.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Dec 2011 01:33:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: user@couchdb.apache.org Reply-To: user@couchdb.apache.org To: user@couchdb.apache.org From: Ted Zlatanov Subject: Re: Modeling a tree in couchdb. Date: Wed, 28 Dec 2011 19:33:05 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Lines: 30 Message-ID: <87ehvoqkse.fsf@lifelogs.com> References: <4EF45C4A.5080902@gmail.com> <87zkeet1or.fsf@lifelogs.com> <4EFB9341.1090607@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-76-28-40-19.hsd1.vt.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:FUX7s02RCZobSR6B+clY7dCJ740= X-Virus-Checked: Checked by ClamAV on apache.org On Wed, 28 Dec 2011 23:08:01 +0100 Jo-Erlend Schinstad wrote: JS> Den 27. des. 2011 17:32, skrev Ted Zlatanov: >> How big is this document? If it's like the TreeModels I've used, maybe >> you can simply keep the whole connectivity data (the edges of the graph) >> in one document, and the nodes have one document each. That way you can >> load or update the graph in one shot; replication is simpler; >> consistency is better (at worst, a node is missing). Renumbering is >> easier as well, since you just load a single document, rewrite it, and >> save. >> >> If this is a huge tree or you expect multiple clients to update the >> connectivity graph this is not a great solution. >> JS> Thanks for the suggestion. Interesting idea. The problem is that I JS> want this to be a general solution, which means I don't know how big JS> it will be or whether it'll be accessed simultaneously by different JS> users. One suggestion... If you don't expect elements and subtrees to move around much (if it's mostly append activity), you can break the connectivity document into pieces when it gets big enough. It can be better than storing the full list of edges, which for a large tree will be huge, or implicitly creating edges based on node child/parent attributes, which is expensive. But it's not general, of course: rebalancing the tree will be painful and moving a node can require 2 rewrites instead of 1, so you could end up with the node in two locations temporarily. And you have to write code to do it :) Ted