[Zope3-Users] ZODB and unique values

Gustavo Rahal grahal at linux.vnet.ibm.com
Thu Aug 6 09:28:08 EDT 2009


Em Ter, 2009-08-04 às 06:28 -0400, Jim Fulton escreveu:
> On Mon, Aug 3, 2009 at 9:09 PM, Gary Poster<gary.poster at gmail.com> wrote:
> >
> > On Aug 3, 2009, at 3:00 PM, Gustavo Rahal wrote:
> ...
> > Practically, using the BTrees that the ZODB provides will typically
> > have the behavior you want for the first and third gotcha.  For the
> > second gotcha, we typically give each connection to the ZODB its own
> > random starting point stored on a volatile (disposable) attribute for
> > the index, and each connection increments that point.  Look at the
> > code in zope.intid, for instance: _generateId in http://svn.zope.org/zope.intid/trunk/src/zope/intid/__init__.py?rev=100049&view=auto
> 
> 
> Gustavo,
> 
> Note that a simpler variation on this is to assign the values
> randomly.  Assigning them sequentially from a random starting point is
> an optimization to reduce the number of BTree nodes read and updated
> by a particular client.
> 
> Jim
> 

Thanks for the responses. I realized that I'm mixing Zope3 with ZODB. So
I should have asked if Zope3 offers anything in the uniqueness direction
and I found out that apparently it does. Anyway, it was good to know how
to deal with uniqueness in ZODB "standalone"

pg 61 of Zope3 Web Component Architecture

Schema field parameters

"unique -> Specifies whether the values in a collection must be unique
or not. Applicable to all collection fields (including sequence fields)"

I guess that is what I wanted correct?
 



-- 
Gustavo Matheus Rahal
IBM Linux Technology Center




More information about the Zope3-users mailing list