[ZODB-Dev] RFC: Pre-commit hooks

Jim Fulton jim at zope.com
Mon Apr 4 12:15:36 EDT 2005


Jeremy Hylton wrote:
> On Apr 4, 2005 10:53 AM, Jim Fulton <jim at zope.com> wrote:
> 
>>   We would also modify transaction commit methods to call hooks.  Hooks would
>>   not be called on sub-transaction commit.  (If necessary, we could add
>>   separate sub-transaction hooks, but I don't think we need this.)
> 
> 
> The effect here is to register a one-short synchronizer, so all the
> code already exists.  Or, add another line just after the
> beforeCompletion() call in _transaction.py.  I think the question to
> ask is how to make these two closely related APIs understandable to
> users.  The synchronizers API is slightly more general, but still
> focused clearly on observing transaction boundaries.  Perhaps the new
> hook is just a sugar on top of the synchronizer API.

See my response to your earlier comment. I don't think the existing api
is a very good fit at all.

> 
>>   This hook is very simple to use an implement and, I think, addresses
>>   the requitement much more directly than implementing special data
>>   managers.
> 
> 
> Perhaps you misunderstand the synchronizer API.  It does not deal with
> data managers at all.  The registered objects just implement
> beforeCompletion() and afterCompletion().

I would argue though that it is well suited to data managers and
not well suited to the use case in question.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list