Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 7875 invoked from network); 8 Feb 2011 00:01:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2011 00:01:52 -0000 Received: (qmail 32531 invoked by uid 500); 8 Feb 2011 00:01:50 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 32417 invoked by uid 500); 8 Feb 2011 00:01: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 32409 invoked by uid 99); 8 Feb 2011 00:01:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 00:01:49 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robert.newson@gmail.com designates 209.85.214.52 as permitted sender) Received: from [209.85.214.52] (HELO mail-bw0-f52.google.com) (209.85.214.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 00:01:43 +0000 Received: by bwz4 with SMTP id 4so5317851bwz.11 for ; Mon, 07 Feb 2011 16:01:22 -0800 (PST) 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:content-transfer-encoding; bh=0tNaFiPwSwQSXIQYlUCRFfKhECAT6onL1ggjowBR4io=; b=u1a98fCaOQFepVyOQCkmAYn+KDXGGkI5XUdrZnADrsIBbQIR9MZsYPwQpKbZ4Xguu/ OUdL8an/wDQunfEUOott0q96yjz6MWWrGqU8J5oyUyzPvMc2Lsk+qrrP4IVZ5ewZfezw CJWuDoMAgH2Qn2hJt1bNkos77ONqyo1LsZytI= 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:content-transfer-encoding; b=bKbVrAb93FYhXphaH1nwvPKqAWhBADR2juNfTkrXFPQQlwQwDr5ZLa22t2as6WMoMS S6DTcsjPXzchn0r6i1x9ubiHMrbwd4+cv8qEpeIFPOeP6w+2aj7yrlg3jZSjLn8bO2Zm eNSfbr/YhP7kNb8fsMZut3AoBYys4g70Dt2ao= MIME-Version: 1.0 Received: by 10.204.98.65 with SMTP id p1mr16431484bkn.198.1297123282479; Mon, 07 Feb 2011 16:01:22 -0800 (PST) Received: by 10.204.113.146 with HTTP; Mon, 7 Feb 2011 16:01:22 -0800 (PST) In-Reply-To: <4D508749.2080806@databill.com> References: <4D507F64.7030405@databill.com> <8117E686-BE57-4003-BB56-B9F4C2EA954D@rowanshire.net> <4D508749.2080806@databill.com> Date: Tue, 8 Feb 2011 00:01:22 +0000 Message-ID: Subject: Re: Atomic update of multiple attachments? From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org You could also use the COPY feature. :) On Mon, Feb 7, 2011 at 11:59 PM, Wayne Conrad wrote: > Bob, One of my needs is that requestors can get the most recent "complete= " > set of attachments, even while a new set is being assembled. =A0I've no s= ense > of what it takes to work with previous version of a document, esp. since = (as > I understand it) replication doesn't transfer old revisions of documents. > =A0Do you think your idea can be made to work with this need? > > I'm wondering if something can be done that's similar to how we > create/rename files in Unix. =A0Can I create a temporary document, load i= t up > with attachments, and then rename it? > > Wayne > > On 02/07/11 16:38, Robert Johnson wrote: >> >> Create your document with attributes "eventual_attachment _count" (set >> this to the expected count) and "attachment_count_so_far" (set this to >> zero). >> As you add each attachment, increment "attachment_count_so_far" >> >> Create a view which only emits when "attachment_count_so_far" =3D >> "eventual_attachment _count" >> >> >> For update:- >> >> Remove docs and decrement "attachment_count_so_far" >> Reset "eventual_attachment _count"if necessary >> Add new attachments and increment "attachment_count_so_far" >> >> Does this work for you? >> >> Bob >> >> On 7 Feb 2011, at 23:25, Wayne Conrad wrote: >> >>> Is there anything I can do to achieve the illusion of atomic update of = a >>> set of attachments? =A0Here's the effect I'd like: >>> >>> For create: >>> 1. Create a document. >>> 2. Add attachments to it. >>> 3. Only now does the document and all of its attachments become visible= . >>> >>> For update: >>> 1. Delete all of the document's attachments. >>> 2. Add a new set of attachments to the document. >>> 3. Only now does the new set of attachments appear to replace the old. >>> >>> I'm using Couchdb 1.0.2 and CouchRest 1.0.1. =A0I'm not opposed to chea= ting >>> to achieve my goal. =A0Suggestions of "Did you think of doing this-othe= r-thing >>> instead?" are also welcome. >> > >