Table of Contents

Class: ITransactionService ./src/peak/storage/interfaces.py

Manages transaction lifecycle, participants, and metadata.

There is no predefined number of transactions that may exist, or what they are associated with. Depending on the application model, there may be one per application, one per transaction, one per incoming connection (in server applications), or some other number. The transaction package should, however, offer an API for managing per-thread (or per-app, if threads aren't being used) transactions, since this will probably be the most common usage scenario.

Base Classes   
Interface
Methods   
__contains__
abort
addInfo
begin
commit
fail
getInfo
getTimestamp
isActive
join
removeParticipant
  __contains__ 
__contains__ ( participant )

Has participant joined?

  abort 
abort ()

Abort the transaction, or raise OutsideTransaction if not in progress.

  addInfo 
addInfo ( **info )

Update the transaction's metadata dictionary with the supplied keyword arguments. This can be used to record information such as a description of the transaction, the user who performed it, etc. Note that the transaction itself does nothing with this information. Transaction participants will need to retrieve the information with getInfo() and record it at the appropriate point during the transaction.

  begin 
begin ( **info )

Begin a transaction. Raise TransactionInProgress if already begun. Any keyword arguments are passed on to the setInfo() method. (See below.)

  commit 
commit ()

Commit the transaction, or raise OutsideTransaction if not in progress.

  fail 
fail ()

Force transaction to fail (i.e. no commits allowed, only aborts)

  getInfo 
getInfo ()

Return a copy of the transaction's metadata dictionary

  getTimestamp 
getTimestamp ()

Return the time that the transaction began, in time.time() format, or None if no transaction in progress.

  isActive 
isActive ()

Return True if transaction is in progress.

  join 
join ( participant )

Add participant to the set of objects that will receive transaction messages. Note that no particular ordering of participants should be assumed. If the transaction is already active, participant will receive a begin_txn() message. If a commit or savepoint is in progress, participant may also receive other messages to "catch it up" to the other participants. However, if the commit or savepoint has already progressed too far for the new participant to join in, a TransactionInProgress error will be raised.

  removeParticipant 
removeParticipant ( participant )

Force participant to be removed; for error handler use only


Table of Contents

This document was automatically generated on Mon Apr 22 01:11:04 2024 by HappyDoc version 2.1