[Zope3-Users] Modified IntId utility

Benji York benji at zope.com
Wed Sep 26 06:48:38 EDT 2007


Maken Seteva wrote:
>> On 24. Sep 2007, at 18:53, Maken Seteva wrote:
>>
>>> Fellow Zopers.
>>> I have made a slight modification to my intid util by inheriting from IntId 
>>> and overriding _generateId().
>>> I do this to be sure that all new created objects will have an incrementing 
>>> number where
>>> the first object created gets id 1, the next gets id 2 and so on. This way I 
>>> get for "free" sorting by
>>> oldest/newest.

> Not fully sure how to resolve conflicts though as I'm quite new to this. 

The best way to resolve conflicts is to not create them.  If you use the 
most significant bits of your int ID as a counter, and fill the least 
significant bits with conflict busting randomness, you'll be in good 
shape.  We (ZC) have a package that does just that which we really need 
to release.  If there's interest I'll take a stab at doing that soon.
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope3-users mailing list