Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BED3910BC7 for ; Tue, 3 Dec 2013 18:40:03 +0000 (UTC) Received: (qmail 36512 invoked by uid 500); 3 Dec 2013 18:40:03 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 36470 invoked by uid 500); 3 Dec 2013 18:40:03 -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 36462 invoked by uid 99); 3 Dec 2013 18:40:03 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 18:40:03 +0000 Received: from localhost (HELO mail-ve0-f177.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 18:40:03 +0000 Received: by mail-ve0-f177.google.com with SMTP id db12so10475471veb.8 for ; Tue, 03 Dec 2013 10:40:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WX0rl2lvnKzFdaxScfsw5sT+XA/hiUWqtd33EBy7JrY=; b=Y2kuiosNJ4vLvpWx4TNXYoBdaudbdXUo2INmGj32IF2QeLD3O+O+38Y/LUXprBoVwU jxatZVNWQ9du4wFI9ypNKJZ0hUMJIthwlY25Pw9+GuiDSXKui+GWsNvDUETFd2fa/G+S QXYuE3BNwGKz2J7WuPa14e67eAYL9HwJ6y3OxUFFOd25ms1HJAKBEc1GiC0OmhmVjVAb 3OeqWc9kMW4JV03JQwDBWJQ3zWnbsxFVf5GWy0zVdMIzWu+w8DHPfnsjjEFoJvctxqyW 5V/E+ZSAxCDhz5pdweDGAfbEFioIKKXN2gxNWTDaMCd0mVJIu6WtObVbxLRfTCs2RODw /nVw== MIME-Version: 1.0 X-Received: by 10.220.49.8 with SMTP id t8mr110572vcf.49.1386096002022; Tue, 03 Dec 2013 10:40:02 -0800 (PST) Received: by 10.220.251.70 with HTTP; Tue, 3 Dec 2013 10:40:01 -0800 (PST) In-Reply-To: References: <529DE44C.4090400@bigbluehat.com> <529DFA3E.3010706@gmail.com> <529E20E8.2070900@bigbluehat.com> Date: Tue, 3 Dec 2013 18:40:01 +0000 Message-ID: Subject: Re: [PROPOSAL] new underscore namespacing From: Robert Newson To: "dev@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 'there could be used optimistic conflict model when couchdb will disallow atts with names that are already reserved by handlers' You should flag jokes for the avoidance of doubt. B. On 3 December 2013 18:37, Alexander Shorin wrote: > Instead of /_/ there could be used optimistic conflict model when couchdb > will disallow atts with names that are already reserved by handlers. IT > would be like document conflict resolution, but more tricky. > > P.S. Sorry fir typos in both mails, wrote them from phone with frozen > fingers (-10 outside there) > On Dec 3, 2013 10:20 PM, "Benjamin Young" wrote: > >> >> On 12/3/13, 1:11 PM, Alexander Shorin wrote: >> >>> +1 for meta. It's cool idea and every doc has some meta info like type >>> field >>> >>> -1 on /_/ url thing. It's ugly and not related to reserved namespace: you >>> may define any named handler in config file and having _ prefix saves you >>> from collision with atts (but it's still optiona) >>> >> >> So collision with attachments is exactly the situation this was proposed >> out of. >> >> Sphinx (for one...among many...), uses "_*" prefixed folders for it's >> styles, templates, etc. So does Github's ghpages. >> >> As such, you have to change how those things work in order to store their >> files in CouchDB. >> >> What I'm after is the ability to dump "whatever" into CouchDB and have it >> work. :) Without having to care about what the database chose to reserve. >> >> The point with "/_/" was to narrow the surface area of the API. >> >> The proposal's uncovered lots of other issues and ideas. Which is great! ;) >> >> On Dec 3, 2013 7:37 PM, "Volker Mische" wrote: >>> >>> On 12/03/2013 03:01 PM, Benjamin Young wrote: >>>> >>>>> Hi all, >>>>> >>>>> Recently the "doc._*" reservation has been causing me trouble when >>>>> pulling in "arbitrary" JSON from various sources that also use the >>>>> underscore prefixed names for things (HAL [1], vnd.error [2], other >>>>> APIs). I've also hit the wall several times when trying to import >>>>> filesystem contents (Sphinx, ghpages, and the like) that use _* >>>>> prefixing for their "special folders." >>>>> >>>>> As such, I'd like to propose the following: >>>>> 1. Begin storing new reserved terms in doc._.* (rather than doc._*). >>>>> - this gives developers one object to look into for the meta-data >>>>> about >>>>> a doc >>>>> - you can see the scope creep of our current doc._* best in the >>>>> replicator status messages. >>>>> - doc._ replication_* would become doc._.replication.* >>>>> 2. Move "magic" API endpoints under "/_/" term as well (for the sake of >>>>> attachments. >>>>> - _design/doc would stay the same >>>>> - but the child endpoints would live under "_design/doc/_/*" >>>>> - _design/doc/_/view/by_date >>>>> - _design/doc/_/list/by_date/ul >>>>> - _design/doc/_/rewrite >>>>> >>>>> I realize these are extreme API shifts, and would need to wait for >>>>> CouchDB 2.0. >>>>> >>>>> The first steps this direction would be to put new reserved word keys >>>>> into a "doc._.*" namespace going forward. Closer to the "cut over" for >>>>> 2.0 duplicates of the existing keys (doc._id, doc._rev, especially) >>>>> could also live at their new underscore prefixed names (doc._.id, >>>>> doc._.rev) which would give devs a chance to migrate code and content. >>>>> >>>>> Doing this would: >>>>> 1. Give us "limitless" space to add content. >>>>> 2. Encourage a namespacing pattern for things like doc._.replication.* >>>>> or other logically grouped content. >>>>> 3. Free up CouchDB to accept a far broader range of content and remove >>>>> the "hey, you can't put that there! I was here first!" errors. :) >>>>> >>>>> Thanks for considering this, >>>>> Benjamin >>>>> >>>>> [1] http://stateless.co/hal_specification.html >>>>> [2] https://github.com/blongden/vnd.error >>>>> >>>> Hi, >>>> >>>> I personally would prefer to have the meta information completely >>>> separate from the document. I know there have been discussion in the >>>> past to even have them separate in the backend (but that's not the point >>>> of this proposal). >>>> >>>> So the API for the view function could change to `function(doc, meta)`. >>>> This way you could store in your document whatever you like. >>>> >>>> Cheers, >>>> Volker >>>> >>>> >>>> >>>> >>>> >>