[ZODB-Dev] Pluggable transactions logic

Chris Withers chrisw@nipltd.com
Sat, 28 Jul 2001 09:13:43 +0100


> * The ZODB gets an API to support plugging in arbitrary processing at
> various points in transaction processing.
>
> The latter approach is best if you want to keep ZODB simple, but allow
> arbitrary other more complex transaction processing to happen, in
> arbitrary combinations.

This sounds like the way forward to me...

Just so it's recorded somewhere, my API use case would be something like:

from ZODB import registerAgent, COMMIT

class MyObj(PortalContent):
   # My content storage class
   pass

def myMethod(obj)
   obj.portal_catalog.catalog_object(obj)

registerAgent(myMethod,[MyObj],COMMIT,100)

The first argument is the method to be called.

The second argument is a list of classes. This indicates that this method
should be called when objects of that class are committed. Maybe that could
be interfaces as well/instead? If this list is empty, the method gets called
for all types of object.

COMMIT is an integer constant indicating at what point in the transaction
myMethod gets called.

100 is the priority. Methods are called in order of their priority.

...but I don't know enough about everyone elses use cases to try and give a
more complete API...

Comments?

cheers,

Chris