Package Products :: Package ZenUtils :: Module AmqpDataManager :: Class AmqpDataManager
[hide private]
[frames] | no frames]

Class AmqpDataManager

source code

object --+
         |
        AmqpDataManager

Objects that manage transactional storage.

These objects may manage data for other objects, or they may manage non-object storages, such as relational databases. For example, a ZODB.Connection.

Note that when some data is modified, that data's data manager should join a transaction so that data can be committed when the user commits the transaction.

Instance Methods [hide private]
 
__init__(self, channel, txnmgr=None) source code
 
abort(self, transaction)
Abort a transaction and forget all changes.
source code
 
tpc_begin(self, transaction)
Begin commit of a transaction, starting the two-phase commit.
source code
 
commit(self, transaction)
Commit modifications to registered objects.
source code
 
tpc_finish(self, transaction)
Indicate confirmation that the transaction is done.
source code
 
tpc_vote(self, transaction)
Verify that a data manager can commit the transaction.
source code
 
tpc_abort(self, transaction)
Abort a transaction.
source code
 
sortKey(self)
Return a key to use for ordering registered DataManagers.
source code
Method Details [hide private]

__init__(self, channel, txnmgr=None)
(Constructor)

source code 
Overrides: object.__init__
(inherited documentation)

abort(self, transaction)

source code 

Abort a transaction and forget all changes.

Abort must be called outside of a two-phase commit.

Abort is called by the transaction manager to abort transactions that are not yet in a two-phase commit.

tpc_begin(self, transaction)

source code 

Begin commit of a transaction, starting the two-phase commit.

transaction is the ITransaction instance associated with the transaction being committed.

commit(self, transaction)

source code 

Commit modifications to registered objects.

Save changes to be made persistent if the transaction commits (if tpc_finish is called later). If tpc_abort is called later, changes must not persist.

This includes conflict detection and handling. If no conflicts or errors occur, the data manager should be prepared to make the changes persist when tpc_finish is called.

tpc_finish(self, transaction)

source code 

Indicate confirmation that the transaction is done.

Make all changes to objects modified by this transaction persist.

transaction is the ITransaction instance associated with the transaction being committed.

This should never fail. If this raises an exception, the database is not expected to maintain consistency; it's a serious error.

tpc_vote(self, transaction)

source code 

Verify that a data manager can commit the transaction.

This is the last chance for a data manager to vote 'no'. A data manager votes 'no' by raising an exception.

transaction is the ITransaction instance associated with the transaction being committed.

tpc_abort(self, transaction)

source code 

Abort a transaction.

This is called by a transaction manager to end a two-phase commit on the data manager. Abandon all changes to objects modified by this transaction.

transaction is the ITransaction instance associated with the transaction being committed.

This should never fail.