[ZODB-Dev] Re: [Zodb-checkins] SVN: ZODB/trunk/src/persistent/interfaces.py Nail the type of oids, as agreed ; -) to in

Florent Guillaume fg at nuxeo.com
Sat Dec 10 15:44:17 EST 2005


Jeremy Hylton wrote:
>>--- ZODB/trunk/src/persistent/interfaces.py     2005-12-09 16:04:25 UTC (rev 40663)
>>+++ ZODB/trunk/src/persistent/interfaces.py     2005-12-09 16:19:03 UTC (rev 40664)
>>@@ -167,7 +167,9 @@
>>
>>         It is up to the data manager to assign this.
>>         The special value None is reserved to indicate that an object
>>-        id has not been assigned.  Non-None object ids must be strings.
>>+        id has not been assigned.  Non-None object ids must be non-empty
>>+        strings.  The 8-byte string '\0'*8 (8 NUL bytes) is reserved to
>>+        identify the database root object.
> 
> 
> A minor point, but it seems like it would make more sense for the
> storage to choose the id of the root object.  The database doesn't
> actually care what the root is, so long as the storage can return it. 
> You could add a ROOT_OID class attribute to a storage to distinguis
> the value.

Even cleaner IMHO would be to use new methods storage.loadRoot() and 
storage.storeRoot() here instead of doing storage.load(storage.ROOT_OID, 
...) etc. (And let storeRoot choose the initial serial instead of None).

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the ZODB-Dev mailing list