<br><br><div class="gmail_quote">On Thu, Aug 6, 2009 at 9:28 AM, Gustavo Rahal <span dir="ltr"><<a href="mailto:grahal@linux.vnet.ibm.com">grahal@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Em Ter, 2009-08-04 ąs 06:28 -0400, Jim Fulton escreveu:<br>
<div class="im">> On Mon, Aug 3, 2009 at 9:09 PM, Gary Poster<<a href="mailto:gary.poster@gmail.com">gary.poster@gmail.com</a>> wrote:<br>
> ><br>
> > On Aug 3, 2009, at 3:00 PM, Gustavo Rahal wrote:<br>
> ...<br>
> > Practically, using the BTrees that the ZODB provides will typically<br>
> > have the behavior you want for the first and third gotcha. For the<br>
> > second gotcha, we typically give each connection to the ZODB its own<br>
> > random starting point stored on a volatile (disposable) attribute for<br>
> > the index, and each connection increments that point. Look at the<br>
> > code in zope.intid, for instance: _generateId in <a href="http://svn.zope.org/zope.intid/trunk/src/zope/intid/__init__.py?rev=100049&view=auto" target="_blank">http://svn.zope.org/zope.intid/trunk/src/zope/intid/__init__.py?rev=100049&view=auto</a><br>
><br>
><br>
> Gustavo,<br>
><br>
> Note that a simpler variation on this is to assign the values<br>
> randomly. Assigning them sequentially from a random starting point is<br>
> an optimization to reduce the number of BTree nodes read and updated<br>
> by a particular client.<br>
><br>
> Jim<br>
><br>
<br>
</div>Thanks for the responses. I realized that I'm mixing Zope3 with ZODB. So<br>
I should have asked if Zope3 offers anything in the uniqueness direction<br>
and I found out that apparently it does. Anyway, it was good to know how<br>
to deal with uniqueness in ZODB "standalone"<br>
<br>
pg 61 of Zope3 Web Component Architecture<br>
<br>
Schema field parameters<br>
<br>
"unique -> Specifies whether the values in a collection must be unique<br>
or not. Applicable to all collection fields (including sequence fields)"<br>
<br>
I guess that is what I wanted correct?<br>
<div class="im"></div></blockquote><div><br></div><div>depends on what your looking for. if your looking for a value to be within a collection on a single persistent object, you can utilize this, but at a cost of write concurrency, as it creates a chokepoint for multiple writers. for multiple persistent objects in the object database you'll need something additional. gary's reply gives a more technical understanding of the solutions. another simple solution is to use the unique value as the object's key within its container.</div>
<div><br></div><div>cheers,</div><div><br></div><div>kapil</div><div><br></div></div>