[Zope3-dev] Re: ObjectHub notes: removing objects

Gary Poster gary@zope.com
23 Oct 2002 15:20:10 -0400


On Wed, 2002-10-23 at 14:49, Florent Guillaume wrote:
> Here's an attempt to describe how I understand all that.
> 
> 
> As Steve said, the ObjectHub's contract is to keep a registration of
> HubId <-> location mapping. So all that the subscribers of the ObjectHub
> are interested first interested in is:
> 
>  - IObjectRegisteredHubEvent: there is a new object registered in the Hub,
> 
>  - IObjectUnregisteredHubEvent: an object has been unregistered.
> 
> Such a subscriber could be a metadata cache or indexing service, or a
> relationship manager.

or Steve's query service, or any number of things.  Yes.
 
> Now it appears that deciding what objects should be registered in the
> ObjectHub may be delegated to plugins or outside utilities. These
> utilities may "instruct" the ObjectHub, and I'm pretty sure using events
> here would not be the correct thing, I'd use simply methods of the
> ObjectHub. Just mentionning this to be sure.

Yes. :-)
 
> There's another set of events that is interesting: for utilities that
> track certain objects through their HubId, they may want for simplicity
> to be relayed plain IObjectEvents through the ObjectHub so that they
> receive the HubId info with the event. So here the role of the Hub would
> be to forward all standard IObjectEvents (that concern an object that is
> in the ObjectHub) as IObjectHubEvents to interested listeners. Here I
> can see the use of IObjectModifiedHubEvent, IObjectMovedHubEvent, and so
> on. A general mechanism to be able to forward any kind of event but with
> additional info (HubId) would be nice.

Hm.  Not sure I like the general mechanism tacking on the hub id
information, but yes, *all* events the objecthub receives are passed on
to subscribers, only filtered by the *subscribers'* wishes.  If the
object hub also recognizes the event as being pertinent to an object
registered in the object hub then it, in addition, creates parallel hub
event objects and sends those to interested subscribers.  It is assumed
that most subscribers will only be interested in one set of events or
another; and if they *do* want them all, they can set their filters
appropriately.
 
> The way I interpret the current discussion thread is, are
> IObjectAddedHubEvent and IObjectRemovedHubEvent useful or are they
> redundant with IObjectRegisteredHubEvent and
> IObjectUnregisteredHubEvent?
> 
> I'd say they are not redundant. Yes, IObjectRemovedHubEvent implies
> IObjectUnregisteredHubEvent (the object no longer exists) and
> IObjectAddedHubEvent implies IObjectRegisteredHubEvent (we're hearing
> about a new object from the ObjectHub so it must have been registered).
> But the implication does not go the other way, so the events are not
> equivalent.

FWIW, the current decision in code, in both the old object hub and the
local object hub, is to eliminate the IObjectAddedHubEvent but keep the
other three.  The logic why has been discussed, and we all will agree or
disagree.  I think what we have is a good, practical, working
compromise.  It won't be set in stone till the Pope says so. :-)

> Well, at least it clarified *my* thoughts on the matter :-)

:-)

Gary