[ZODB-Dev] Feature Request 2381 : Persistent object iterator in Storage

JohnD.Heintz JohnD.Heintz
Fri, 6 Jul 2001 17:39:07 -0500


I'll take a close look at the code below but I don't think it would give =
me=20
everything I want.  On of the things that I want to support is class=20
migration of Persistent objects. =20

I want to:=20
1) get the _p_oid of all the objects in a Storage
2) call p, serial =3D storage.load(oid, version)
3) call klass, args =3D unpickler.load(p)
4) determine is klass is being replace and when necessary:
5) call storage.store(oid, serial, dump(newKlass, args), ...)

John

On Friday 06 July 2001 16:27, Barry A. Warsaw wrote:
> >>>>> "GW" =3D=3D Greg Ward <gward@mems-exchange.org> writes:
>
>     GW> Yes, I would like to see an official API for this too.  I'll
>     GW> attach a script I wrote to walk over an entire ZODB by
>     GW> incrementing OIDs.  It's more interesting than useful, but it
>     GW> *is* interesting.  ;-) It won't work out-of-the-box because it
>     GW> relies on our init_database(), get_connection(), and
>     GW> get_database() utility routines.  Exercise for the reader,
>     GW> etc. etc.
>
> There is a (under-documented <wink>) iteration interface for storages,
> which might give you what you need.  FileStorage and now Berkeley Full
> storage both support this interface, and BaseStorage even has a
> copyTransactionsFrom() method that will copy all transactions and
> objects from a source storage into the destination storage.
>
> FWIW, I'm using this to debug some problems with Full's pack() method.
> I can create a reproducible problem with a couple of Zope actions,
> then I copy its database into a virgin Full db, and can now run pack()
> over the copy without destroying the evidence.
>
> I don't think this interface is actually documented anywhere, except
> in an email Jim sent to me a few weeks ago.  He slapped a ZPL on it,
> so I don't see why I can't post it here <wink>.  It's in scarecrow
> form.
>
> Does this help?
>
> -Barry

----------------------------------------
Content-Type: text/plain; charset=3D"us-ascii"; name=3D"Attachment: 1"
Content-Transfer-Encoding: 7bit
Content-Description:=20
----------------------------------------

--=20
=2E . . . . . . . . . . . . . . . . . . . . . . .

John D. Heintz | Senior Engineer

1016 La Posada Dr. | Suite 240 | Austin TX 78752
T 512.633.1198 | jheintz@isogen.com

w w w . d a t a c h a n n e l . c o m