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 E51682630 for ; Thu, 21 Apr 2011 03:59:57 +0000 (UTC) Received: (qmail 83030 invoked by uid 500); 21 Apr 2011 03:37:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 82742 invoked by uid 500); 21 Apr 2011 03:36: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 79885 invoked by uid 99); 21 Apr 2011 03:35:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 03:35:57 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of wanpeebaw@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 03:35:24 +0000 Received: by ewy28 with SMTP id 28so571968ewy.11 for ; Wed, 20 Apr 2011 20:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=O8Lk5S8B0oXSPbIx/N2KQFTX1KRAwUIilSoFgbBntPY=; b=V5Oq23l8xtAalNlj/oHhOdTLNFnfd9yb6Ta2ilDNMuRo1pmgCpXO2HHyWGyKLQKpBC eejttQ7+lAokxr0LoKNGfp/0rXiekY10kTaHaM5h7FpiOhX4MIrrVwjQDLyDzLNopeOx A/KFOK0L+h9POdSvBaCoIWa7HH/UT5Rbc0Q00= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=cNagyolAuOQ3Mj5DD1QN6yq+xBZWMh7oxeWJvk1BWsC6N5ZgeLt4B9Uf6btKOGbVda PTQIOnM1cdqyK4ERAM1psHDOEWFt7fiGJEQ8WGguwh0nI4zuQ9D5EOE5/xodmBUoX8C4 PN2W1gQz+RZ2ApsOBVkOnlQMYYFSpSNyvHCEU= MIME-Version: 1.0 Received: by 10.213.97.30 with SMTP id j30mr53759ebn.20.1303356903514; Wed, 20 Apr 2011 20:35:03 -0700 (PDT) Received: by 10.213.29.74 with HTTP; Wed, 20 Apr 2011 20:35:03 -0700 (PDT) In-Reply-To: References: <1303324273.25024.1301.camel@dynamo> Date: Thu, 21 Apr 2011 11:35:03 +0800 Message-ID: Subject: Re: JSON-Patch From: sleepnova To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=001636c5b77f3fe17a04a1656d67 X-Virus-Checked: Checked by ClamAV on apache.org --001636c5b77f3fe17a04a1656d67 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Maybe it's viable to use different Content-Type to switch different state transition formates. (PATCH or ACTION verb) For example: patch json javascript Each one has it's own advantages on describing state transfer. For example, it's not easy to create or apply a text (or binary) patch with in a browser environment. 2011/4/21 Paul Davis > Skimming RFC3284 it appears to be byte based which seems quite > incompatible with couchdb internals. > > On Wed, Apr 20, 2011 at 5:37 PM, Robert Newson > wrote: > > supporting RFC 3284 format for PUT has been proposed before, and it's > generic. > > > > B. > > > > On 20 April 2011 21:55, sleepnova wrote: > >> A sudo patch for demonstration. > >> > >> if(doc._rev=3D=3D"07769cff70767095e4fb525dc9000b6e"){ > >> //Put your patch here > >> } > >> > >> I think above patch would be idempotent even when add or remove an arr= ay > >> element based on an index. > >> > >> 2011/4/21 sleepnova > >> > >>> A patch which checks document version number might solve this problem= . > >>> similar to a git commit log > >>> > >>> > >>> 2011/4/21 Aur=C3=A9lien B=C3=A9nel > >>> > >>>> Dear Paul, > >>>> > >>>> > On the other hand, there's nothing inherently wrong with the PATCH > verb > >>>> > >>>> True, PATCH could be idempotent... It just depends on your patch > format. > >>>> > >>>> I just had a look at your patch operations specification: > >>>> - When you add or remove a key/value, this is idempotent. > >>>> - However, when you add or remove an array element based on an index= , > this > >>>> is not. > >>>> > >>>> > >>>> Regards, > >>>> > >>>> Aur=C3=A9lien > >>> > >>> > >>> -- > >>> - sleepnova > >>> > >> > >> -- > >> - sleepnova > >> > > > --=20 - sleepnova --001636c5b77f3fe17a04a1656d67--