Code review comment for lp:~free.ekanayaka/storm/zstorm-access

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Hi Gustavo, thanks for reviewing.


The use case is to be able to access the stores managed by a certain ZStorm instance from a Storm object. Let's say you have two stores, with a storm class Foo belonging to the first and a storm class Bar belonging to the second. Now you want to write a Foo.egg() method with some logic that accesses the second store to find some instances of the Bar class. Right now what one would probably do is to run a queryUtility(IZStorm) to get a global ZStorm instance and get the second store object from it.

The problem with this is that I don't see a way to have two ZStorm instances managing separate sets of stores for two entirely different models in the same process (because queryUtility returns you a global per-process object, unless you register your two ZStorm instances as named utilities, but then you introduce some coupling between the two models). Web frameworks like Pyramid let you run multiple applications in the same process, but if one uses ZStorm in the way described, it might be problematic, see also:

Beside this, it can be useful for parallel testing.

The alternative I see is to pass around the particular ZStorm instance you want and add it as parameter to the Foo.egg() method, but that sounds more laborious than being able to access it via ZStorm.of().

As for the blob of data, maybe it's to open, what I'd use it for is to let storm objects access a non-global Zope registry to query for application components in a non-global way.


Sure, what problem does the reference cycle bring? If it has bad implications maybe there's a better way.

« Back to merge proposal