[ZODB-Dev] Re: record_iternext API is broken
Jim Fulton
jim at zope.com
Tue Apr 24 19:23:05 EDT 2007
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:jim at zope.com Python Powered!
> CTO (540) 361-1714 http://www.python.org
> Zope Corporation http://www.zope.com http://www.zope.org
>
>
>
--
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