[ZODB-Dev] transaction observer iface
Shane Hathaway
shane at zope.com
Sat Feb 21 20:05:35 EST 2004
On Fri, 20 Feb 2004, John Belmonte wrote:
> Shane Hathaway wrote:
> > Every transaction participant is already an observer, isn't it? It seems
> > like the only functionality you added is notifyObjectRegistered();
> > everything else is accessible through tpc_*. Maybe I misinterpreted.
>
> Would you please explain how to use that interface (and what "tpc"
> stands for)?
TPC stands for two-phase commit. Look at the CommitVersion class in
ZODB/DB.py. It implements the tpc_* methods, commit(), and abort(). You
can create a CommitVersion instance and register it to become part of the
transaction by calling get_transaction().register(my_commitversion).
Once registered, the object will be notified of changes to the
transaction's state. CommitVersion uses the notifications to commit or
abort a large change to the database.
Note that CommitVersion does not implement Persistent. This is important.
If you register a Persistent object with a transaction, the transaction
assumes that you want the object's _p_jar to receive the notifications.
If you want to receive notifications directly, don't subclass Persistent.
Shane
More information about the ZODB-Dev
mailing list