[ZODB-Dev] Find references to an object

Jeremy Hylton jeremy@alum.mit.edu
Wed, 8 Aug 2001 16:15:46 -0400 (EDT)


>>>>> "GW" == Greg Ward <gward@mems-exchange.org> writes:

  GW> ZODB gurus -- given an OID, is it possible to find all objects
  GW> that reference that object?

I don't believe any storage has a feature like this.  A storage only
needs to know about the other direction to do GC.

  GW> Perhaps what I'm looking for is this: a sneaky, underhanded way
  GW> to load object A, find the list of all objects (OIDs) it
  GW> references, and see if object B is in that list.  If so, add
  GW> object A to the list of objects referencing B.  Repeat
  GW> database.objectCount() times.  The problem I see with this is
  GW> how to deal with extension types like BTree, which reference
  GW> lots of objects in an opaque way.

  GW> Any suggestions?

If you have objects A and B, it should be possible to get a list of
everything referenced by A and see if B is in that list.

Jeremy