> AFAICT, it would make more sense to move the logic for invoking callbacks
> into TransactionManager. Transaction() currently takes an optional
> `sychronizers` argument that it never mutates, for which a
> TransactionManager always passes its set of registered synchronizers.
> Since ISynchronizer hooks are registered with a transaction manager
> rather than with a transaction, it makes more sense to me for the
> transaction manager to invoke them (as is, we're duplicating a TM
> instance var inside every T).
Oh, fudge -- that doesn't work. The callbacks take a transaction object as
an argument, so they pretty much have to be invoked by Transaction. That
also makes it problematic to invoke them from TransactionManager.begin()
(what gets passed as the txn? Passing a brand new txn to a method called
"afterCompletion()" doesn't make a lot of sense on the face of it). OTOH,
data managers don't have any other method to call with a "sync the
underlying storage/data_source" meaning -- Connection.sync() certainly
doesn't have that meaning, since it also aborts the current transaction, and
wrt to all data managers, not just itself.
sync'ing via TM.begin() remains a puzzle.
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org