[Zope3-dev] zwiki: performance of findChildren()

Shane Hathaway shane@zope.com
Fri, 25 Apr 2003 12:12:22 -0400


Jeremy Hylton wrote:
> On Fri, 2003-04-25 at 03:23, Roch=E9 Compaan wrote:
>=20
>>>What is an mxmRelation?
>>
>>It is a BTree storing bi-directional relations between objects (from
>>Max's mxmRelations Product).
>>
>>
>>>I was thinking that some kind of property could
>>>be used to provide indexex relations in ZODB, where client code could
>>>treat the relation just like any other attribute.  Is that the basic
>>>idea of what you're doing?
>>
>>Precisely!
>>
>>
>>>I'm not clear on how this would get integrated with the ObjectHub, but
>>>it seems pretty useful for ZODB applications in general.
>>
>>Absolutely. It would make life a lot easier.
>=20
>=20
> I'd be quite interested to have something like this in ZODB4.  I'm stil=
l
> unclear on how Zope3 could exploit the feature, because of its extra
> place-related requirements.  Does anyone know if there are design notes
> on how this sort of stuff is supposed to work in Zope3?

Let me tell you what I've figured out, then I'd like you to elaborate=20
more on these relations.

In Zope (both Zope 2 and Zope 3), we want to be able to refer to objects=20
in context.  As you know, the OID doesn't tell you enough to do that.=20
You usually don't want to use paths to refer to objects in context=20
either, since the path can change.  You don't want to make a registry of=20
OID to path, since OIDs should not have any meaning to the application.

So the ObjectHub solution is to assign a new arbitrary ID to objects--a=20
"hubId"--and keep a registry of hubId to path.  That way an object can:

- Make "weak" references to other objects

- Refer to an object even if it moves or gets exported/imported

- Avoid depending on OIDs

So, that's my understanding of the core of object hub.  Correct me if=20
I'm wrong, anyone.

Another possible benefit I've been pondering is the ability for the=20
application to restore context when reacting to ZODB-initiated events.=20
For example, ZODB might tell the application that some object was=20
modified.  The application looks at the object's hubId and uses the=20
object hub to get the path to that object.  Then it traverses that path=20
and invokes some adapter in that context, sending the event to the=20
adapter.  (Batching events might make it fast.)

So, Jeremy, I'd like to understand this idea of relations better.  What=20
would it look like to the application programmer?

Shane