[ZODB-Dev] Re: record_iternext API is broken

2007-04-24 Thread Jim Fulton


I should have noted that this API isn't widely used AFAIK, so it  
probably wouldn't be that big a deal to change it.  Personally, I'd  
be inclined to change it to return oid, version, and next (or oid and  
next).  Client code could always call load to get the transaction id  
and data.


Thoughts?

Jim

On Apr 24, 2007, at 7:19 PM, Jim Fulton wrote:



There's a semi-formal api for iterating over the current records in  
a storage.  It is best explained with an example:


 next = None
 while 1:
... oid, tid, data, next = storage.record_iternext 
(next)

... # do things with oid, tid, and data
... if next is None:
... break

Basically, next captures iterator state and you call  
record_iternext repeatedly until next becomes None.  This low-level  
API was designed to work with ZEO.  Maybe some day, we'll build a  
higher-level API on top of it.The API is broken, because  
versions aren't returned. In fact, the current FileStorage  
implementation of this, which tries to ignore versions will fail if  
there are objects in the FileStorage that are creates in a  
uncommitted version.  We either need to fix this API, or stop  
supporting versions.  (Not that we're really supporting them very  
well now.)


Jim

--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org





--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Re: record_iternext API is broken

2007-04-24 Thread Stephan Richter
On Tuesday 24 April 2007 19:23, Jim Fulton wrote:
 I should have noted that this API isn't widely used AFAIK, so it  
 probably wouldn't be that big a deal to change it.  Personally, I'd  
 be inclined to change it to return oid, version, and next (or oid and  
 next).  Client code could always call load to get the transaction id  
 and data.

 Thoughts?

I am using it for generation scripts quiet frequently. But if the API becomes 
better, I am more than willing to change those occurences. :-)

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev