On Sep 25, 2007, at 3:27 AM, Frank Burkhardt wrote:
I'm using a modified IntId utility which starts IDs at 1 and counts
I needed some permanent link for each object which was easy to
implement via IntId.
The modification was made to safe keystrokes when typing the
http://server/~251 is a lot easier than http://server/~344357462 :-) .
However, I don't use those IDs for anything else - like sorting.
We do. We use 64-bit intids arranged in ways that help with our most
common sorting requirements (usually time related). Higher-order
bits provide the sort order we care about, and the remaining lower-
order bits provide randomness so that we reduce the chance of
conflict errors. (It still can have a higher theoretical chance for
conflict errors than the "classic" intid approach to assigning keys,
but the BTree conflict resolution algorithm should eliminate the
increase in practice.)
So, we don't follow the exact pattern in the original post, and using
the general pattern has subtleties you need to get right. For
instance, you need to avoid conflict errors, as Stefan mentioned;
and, for simplicity, we regard intids to be immutable and so they
should only be tied to immutable data points about your objects. But
we believe the idea--letting intids have meaning, particularly for
sorting--has merit generally.
...sigh, we need to do some open-sourcing. We've been pretty busy.
Zope3-users mailing list