[ZODB-Dev] record_iternext API is broken
Jim Fulton
jim at zope.com
Tue Apr 24 19:19:52 EDT 2007
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: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