You are not logged in Log in Join
You are here: Home » Members » k_vertigo » Products » FreeTxn

Log in
Name

Password

 
 

Free Transactions

This is an attempt to associate zodb transactions on a per connection basis. the major benefits is by disassociating the transaction to thread association we can have multiple connections in a single thread and hence multiple dbs open while maintaining per connection transaction integrity.

functional changes to application code

Application code can continue to use get_transaction().register(ob) as long as ob is a persistent object or a zodb connection. Application code that tries to integrate non-persistent objects for transactional control needs to call get_transaction() with a persistent object or connection as an arg so that it can be registered with an appropiate connection.

Transitioning between transaction states cannot be done via get_transaction(), a persistent object or connection must be passed in so the proper transaction is returned.

what doesn't work

  • versions... i've never really used versions, so i'm not sure about their implementation, other than it looks strange;)
  • mounted storages. this is an alternative to this approach for multi db systems, but requires? treating multiple dbs as one logical unit. it might work i have no idea... it seems more a zopish thing at the moment.
  • probably most advanced usages... some things i've seen like db.open with a transaction.

basically use of the full range of ZODB features (ie Zope) will not work.

otoh, most basic and common usages as a POS will probably work.

other caveats

multi-threaded code shouldn't have share connections, its probably better for such code to use and return conns to the db as needed.

installation

import this module and call the install_free_txn function, which will hotpatch the connection and transaction classes and install the get_transaction accessor in globals.

  • transaction.py abort free transaction - connection.py sync method, pass in self

tests

i did some basic tests. if it breaks you get to keep both pieces

license

Zope Public License (ZPL) ZPL 1.0 or a later version of the ZPL at your discretion.

author: kapil thangavelu

Latest Release: 0-0-0
Last Updated: 2001-12-12 02:18:53
Author: ZopeOrgSite
Categories: Developer
Maturity: Stable

Available Releases

Version Maturity Platform Released
0-0-0 Stable   2001-12-12 02:18:53
  FreeTxn.py (13 K) All