Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 44448 invoked from network); 13 Dec 2008 04:45:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Dec 2008 04:45:09 -0000 Received: (qmail 95469 invoked by uid 500); 13 Dec 2008 04:45:21 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 95419 invoked by uid 500); 13 Dec 2008 04:45:21 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 95408 invoked by uid 99); 13 Dec 2008 04:45:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 20:45:21 -0800 X-ASF-Spam-Status: No, hits=4.2 required=10.0 tests=MIME_QP_LONG_LINE,NORMAL_HTTP_TO_IP,SPF_PASS,URIBL_RHS_DOB,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of antony.blakey@gmail.com designates 209.85.142.185 as permitted sender) Received: from [209.85.142.185] (HELO ti-out-0910.google.com) (209.85.142.185) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Dec 2008 04:45:05 +0000 Received: by ti-out-0910.google.com with SMTP id a1so1072954tib.3 for ; Fri, 12 Dec 2008 20:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=ew0R0aL5ZSXg9mA4V8h5Xs68cZJma6XNfJmLABCYcQE=; b=k+yjW0BWjIvxgj+/G5aO/iJkHwRZXkr+8bIEXywUi3DSqKve0+2amK25UGM4YrD6LY OI2380AInN+tQ44frt7ym3LrpcX5wFTZgaQLTdRVmorj1xxcoCEo8xXUicJsLJiwHeFs NShPMoBgbxf9QWxMAQKIOEd9l0zhMj0U2FsRg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=M4PviN83OtqG1lkHSlx6iBj7dNpdpDoguX1FjnV0BHORZqL3P4EMGs9gFVXUBL0fCg nRImApMS1WJOmO0A8XtLiJ8udPNRDrjZvbuRGqJSRhbyJs8DRzEde5qGhDZIDgwrncLk 7ZInJ1ymQsMjTcxdKvGsBwiSCdrwTa0udIiFE= Received: by 10.110.109.12 with SMTP id h12mr6318268tic.56.1229143482609; Fri, 12 Dec 2008 20:44:42 -0800 (PST) Received: from ?192.168.0.16? (ppp121-45-41-103.lns10.adl2.internode.on.net [121.45.41.103]) by mx.google.com with ESMTPS id b7sm742222tic.3.2008.12.12.20.44.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Dec 2008 20:44:41 -0800 (PST) Message-Id: From: Antony Blakey To: dev@couchdb.apache.org In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: slash escaping (was 0.9.0 Release) Date: Sat, 13 Dec 2008 15:14:35 +1030 References: <0EC6A3E0-15BA-4BBB-A0A3-9ED9D04E3C40@apache.org> <716BFD51-C24A-438E-B9CA-DD0406F80D45@gmail.com> X-Mailer: Apple Mail (2.929.2) X-Virus-Checked: Checked by ClamAV on apache.org On 13/12/2008, at 7:40 AM, Damien Katz wrote: > The decision to limit names db and design doc names is a pragmatic =20 > one, it simplifies things greatly. CouchDB is full of things that =20 > could be better. Patches welcome. OK, this code now works for me in a client: require 'rubygems' require 'json' require 'couchrest' require 'cgi' db_name =3D CGI.escape("Ser vices/new - =E2=88=9E=E0=A4=B6=E0=A4=9B=D8=BA= =D8=B4=EA=B0=A5=EA=B1=B8=E3=83=9A=E3=83=9C") db =3D CouchRest.database!("http://localhost:5984/" + db_name) db_name =3D CGI.escape("ser vices/new - =E2=88=9E=E0=A4=B6=E0=A4=9B=D8=BA= =D8=B4=EA=B0=A5=EA=B1=B8=E3=83=9A=E3=83=9C") db =3D CouchRest.database!("http://localhost:5984/" + db_name) And this URL in Safari: http://127.0.0.1:5984/Ser+vices%2Fnew+-+=E2=88=9E=E0=A4=B6=E0=A4=9B=D8=BA= =D8=B4=EA=B0=A5=EA=B1=B8=E3=83=9A=E3=83=9C returns this: {"db_name":"Ser vices/new - \u221e\u0936\u091b\u063a=20 \u0634\uac25\uac78\u30da\u30dc","doc_count":1,"doc_del_count":=20 0,"update_seq":1,"purge_seq":0,"compact_running":false,"disk_size":=20 14365} The filesystem looks like this: Ser+vices%2Fnew+-+%E2%88%9E%E0%A4%B6%E0%A4%9B%D8%BA%D8%B4%EA=20 %B0%A5%EA%B1%B8%E3%83%9A%E3%83%9C-lhxj+E81IP9xm+0ssUSsQ=3D=3D.couch ser+vices%2Fnew+-+%E2%88%9E%E0%A4%B6%E0%A4%9B%D8%BA%D8%B4%EA=20 %B0%A5%EA%B1%B8%E3%83%9A%E3%83%9CN2JWdnNzkyqvutQ1OZeKUw=3D=3D.couch The Base64 (filename variant) of the MD5 is appended to deal with case =20= sensitivity. I haven't investigated using platform-attribute-specific =20= code, which would allow filenames to include Unicode characters if the =20= OS supports that and therefore be much shorter. Presuming that files =20 aren't intended to be portable between systems. Note that filenames =20 for ascii names don't look nearly as ugly - not that I consider that =20 to be a problem. Dealing with view filenames can be done similarly. However, I think a better solution is something like this: N2JWdnNzkyqvutQ1OZeKUw=3D=3D.couchdb/ name # a UTF-8 file containing the name of the database data # what was previously in the .couchdb file temp # what was in the .*_temp file lhxj+E81IP9xm+0ssUSsQ=3D=3D.viewgroup/ name # a UTF-8 file containing the name of the view data # what was previously in the .view file I suggest using the MD5 because it can be computed from the names. =20 Alternatively they could be simple integers, which IMO would be a =20 slightly better solution, but a more pervasive change because most of =20= the functions currently take names. Using integers would avoid even =20 the vanishingly small chance of collision. I know the database name is in the data file, but all of the code =20 requires the name before reading the file, and changing that would be =20= a major patch. Furthermore, having the name accessible ensures that =20 sysadmin tasks are still easy (and scriptable). I think this is a =20 better system than the current one because filesystem containment is =20 used rather than filename composition e.g. a database is entirely =20 contained in a directory. Apart from the 'name' files, this is a largely mechanistic change. Opinions? Antony Blakey ------------- CTO, Linkuistics Pty Ltd Ph: 0438 840 787 The intuitive mind is a sacred gift and the rational mind is a =20 faithful servant. We have created a society that honours the servant =20 and has forgotten the gift. -- Albert Einstein