[Zope3-dev] Index integration

Dieter Maurer dieter at handshake.de
Wed Feb 16 14:00:03 EST 2005


Jim Fulton wrote at 2005-2-16 07:24 -0500:
> ...
>BTW, a possibly simpler take on your proposal:
>
>Object-change adapters (Masks?)
>
>- We can adapt an object to an interface that
>   captures just the relevent change.
>
>- We arrange that the adapted object adapts to the same
>   reference and thus gets the same unique id
>
>- The adapted object is only recognized and thus
>   only indexed by the relevent indexes.
>
>Perhaps these adapters are "filters" or "masks", the
>opposite of decorators.  Rather than adding interfaces
>to an object, they mask out interfaces.
>
>With this approach, indexes (or catalogs) don't need to
>be aware of what's going on.

I cannot yet say that I am fully familiar with Zope3 and
its concepts.

But, I expect that objects usually are not modified directly
but via adapters. It would be nice (from my point of view)
when we could arrange that eventing the adapting object
performs the "right thing". This would mean code like this:

	 meta_data = IDublinCoreMetadata(object)
	 meta_data.setXXX(...)
	 zope.event.notity(ObjectChanged(meta_data))

When we could arrange that the adapting object (meta_data in the
example above) adapts to the same reference as "object",
then all applications that need the "true" object ("object" above)
could use the "ReferenceAdapter" to get it.

This approach would make catalog and indexes happy.

However, I recognize that maybe not all applications might be
happy. We did also change "object" (in the example above)
and applications that subscribe to
"(some interface of "object", IObjectChanged)" would not see
such motifications -- neither with this approach nor with
filters/masks...


Here is another idea that works around this problem -- and
is along the lines of your "filter/mask" proposal.

We add a new event "SubobjectChanged(object, subobject)"
derived from "ObjectChanged". "subobject" would describe
the interfaces that were changed. In the example above,
the notification would take the form:

    zope.event.notify(SubobjectChanged(object, meta_data))


Applications interested in any change to "object" would
subscribe to "(some interface of "object", ObjectChanged)".
Indexes would subscribe to "(interface of index, ObjectChanged)"
and "(None, interface of index, SubobjectChanged)".


Unfortunately, index integration might be even more difficult,
because an index might be willing to use an adapter to
transform an object into the interface handled by the index.
But this is a problem separate from the one to indicate
"which part of an object changed".


-- 
Dieter


More information about the Zope3-dev mailing list