[ZODB-Dev] OID length

Jim Fulton jim at zope.com
Fri Dec 9 09:28:55 EST 2005


Florent Guillaume wrote:
> I know this has been raised several times in the past, but I'm not  sure 
> of all the details...
> 
> What layer of ZODB, if any, has a restriction that OIDs be 8-byte  
> strings. Is it the persistence module? Or just FileStorage?
> Also is there a reason (performance, space?) for this restriction,  and 
> would anyone be interested in seeing it removed.
> 
> I'm asking because I'm planning a pretty complex storage layer, which  
> would benefit from more complex OIDs (for instance bigger strings, or  
> tuples of (str, int)).

ZODB imposes no limit on OID length.  The only restrictions on OIDS
imposed by ZODB is that:

- They are strings, and

- The string consisting of 8 null characters is reserved for the
   root database object.

Otherwise, OIDs are controlled by storages, which have complete control
over them.  ZODB and higher-level code sould never make any assumptions
about nor try to control OIDs, except in the case of the root object.

Many storages use 64-bit unsigned integers, serialized as 8-byte strings
for memory and space efficiency and to make allocation of new ids simple.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list