[ZODB-Dev] Pluggable transactions logic

Chris Withers chrisw@nipltd.com
Sat, 04 Aug 2001 13:12:44 +0100


Steve Alexander wrote:
> 
> Products can register that they want to be notified at various points in
> transaction processing.
> 
> These points are:
> 
>    register      to be notified when an object registers itself with the
>    pre-commit    this is where indexing agents and rule agents run
>    boundary      when a transaction gets commited or aborted
>    post-commit   after a transaction is finished
>    abort         when a transaction aborts

These sound great :-)

> A plug-in will register with the ZODB something like this:
> 
> from ZODB.Transaction import registerPlugIn, PRECOMMIT, NORMAL
> 
> registerPlugIn(myMethod, "TransactionAgents indexing and rule agents",
> PRECOMMIT, NORMAL)

Excellent too...

> I have this image of an add-in to the Zope control panel where you can
> interactively jig around with the ordering of the plug-ins. 

This sounds funky, but is it really necessary?

> Note to Chris:
> 
> In your use-case, how do you see your objects uncataloging themselves?

Good point :-S

> When an object gets deleted, it is its parent that gets registered with
> the transaction, not the object. This is because the parent just severs
> the link to the child, and the garbage collector sees to the rest.

Hmmm... tricky, I guess that parent would need to notify the child somehow.
Could this be worked into thsi interface since its' going to eb a common thing
in ZODB terms when any reference to an object is deleted...

> I still think you end up with something like ZPatterns' DataSkin class
> to allow an object to know when it has been changed, and how, and
> whether it is being added, deleted or renamed.

Maybe, I don't remember DataSkins enough to comment...

cheers,

Chris