[Zope3-dev] Synching objects with underlying datastore

Garrett Smith garrett at mojave-corp.com
Fri Aug 20 08:45:04 EDT 2004


Kapil Thangavelu wrote:
> On Thu, 2004-08-19 at 13:00, Garrett Smith wrote:
>> We're using a relational database to store _some_ of the attribute
>> values for ZODB objects. Since it's possible for the RDBMS to be
>> updated independently of Zope, I'd want to synchronize loaded ZODB
>> objects. 
>> 
>> I know about _p_jar.sync() :-)
>> 
>> Is there a way to enumerate the currently loaded ZODB objects. (By
>> 'loaded' I mean those objects whose state is already in memory --
>> maybe 'cached' is what I'm looking for here.) I obviously don't want
>> to take the brute force approach and call _p_jar.sync() on all
>> objects. 
>> 
> 
> _p_jar is the datamanager for a collection of persistent objects, ie
> in a typical setup it is the zodb connection for a number of objects.
> syncing on the data manager only needs to be called once for all the
> objects in the collection.

Would a 'collection' in many/most cases be a Folder? Or is 'collection'
something internal to the ZODB?

> however, if your mixing attribute storage
> for objects at an application level rather than at a datamanager level
> calling sync() on the datamanager will have no effect, as there is no
> mechanism for the datamanager to process these application level
> invalidations. it sounds like you need to have some sort of queue and
> notification management of database changes. if your using postgres or
> oracle you can set it up to recieve notifications of rdb changes and
> manually invoke some sort of application invalidation on the nesc
> objects.

I know when the RDB changes at the (Zope) application level. I can even
get a list of objects that are effected by the RDB change. I want to
avoid, however, synching all objects, since only a subset are actually
cached (in memory). I.e. I don't want to cause an object to be loaded
(__setstate__ called) if I don't have to.

Btw, thanks for the info -- very helpful.

 --Garrett


More information about the Zope3-dev mailing list