class TransactionManager

A class for managing transactions. More...

Definition#include <transaction.hh>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Protected Types

Protected Methods


Detailed Description

The TransactionManager creates, manages, and dispatches transactions. A Transaction is comprised of a sequence of TransactionOperation s. Each transaction is uniquely identified by a transaction id.

typedef ref_ptr<TransactionOperation> Operation

Operation

 TransactionManager (EventLoop& e, uint32_t timeout_ms = 0, uint32_t max_pending = 10)

TransactionManager

Constuctor with a given event loop, timeout, and max pending commits.

Parameters:
ethe EventLoop instance.
timeout_msthe inter-operation addition timeout. If zero, timeouts are not used, otherwise a timeout will occur and the transaction aborted if the transaction is not updated for timeout_ms.
max_pendingthe maximum number of uncommitted transactions pending commit.

 ~TransactionManager ()

~TransactionManager

[virtual]

Destructor

bool  start (uint32_t& new_tid)

start

Start transaction

Parameters:
new_tidvariable to assigned new transaction id.

Returns: true on success, false if maximum number of pending transactions is reached.

bool  commit (uint32_t tid)

commit

Commit transaction

Parameters:
tidthe transaction ID.

Returns: true on success, false on error.

bool  abort (uint32_t tid)

abort

Abort transaction

Parameters:
tidthe transaction ID.

Returns: true on success, false on error.

bool  add (uint32_t tid, const Operation& op)

add

[virtual]

Add operation to transaction.

Parameters:
tidthe transaction ID.
operationto be added.

Returns: true on success, false if tid is invalid.

bool  retrieve_size (uint32_t tid, uint32_t& count)

retrieve_size

[const]

Retrieve number of operations in pending transaction.

Parameters:
tidthe transaction ID.
countvariable to be assigned number of operations in transaction.

Returns: true if tid is valid, false otherwise.

inline uint32_t  timeout_ms ()

timeout_ms

[const]

Get the inter-operation additional timeout.

If the inter-operation addition timeout is zero, timeouts are not used, otherwise a timeout will occur and the transaction aborted if the transaction is not updated for timeout_ms.

Returns: the inter-operation additional timeout.

inline uint32_t  max_pending ()

max_pending

[const]

Get the maximum number of uncommited pending transactions.

Returns: the maximum number of uncommitted transactions pending commit.

inline uint32_t  pending ()

pending

[const]

Get the current number of uncommited pending transactions.

Returns: the current number of uncommitted transactions pending commit.

void  pre_commit (uint32_t tid)

pre_commit

[protected virtual]

Overrideable function that can be called before the first operation in a commit is dispatched.

Default implementation is a no-op.

void  post_commit (uint32_t tid)

post_commit

[protected virtual]

Overrideable function that can be called after commit occurs

Default implementation is a no-op.

void  operation_result (bool success, const TransactionOperation& op)

operation_result

[protected virtual]

Overrideable function that is called immediately after an individual operation is dispatched.

Default implementation is a no-op.

Parameters:
successwhether the operation succeed.
opthe operation.

bool  flush (uint32_t tid)

flush

[protected]

Flush operations in transaction list. May be use by operation_result methods to safely prevent further operations being dispatched when errors are detected. flush() always succeeds if transaction exists.

Parameters:
tidtransaction id of transaction to be flushed.

Returns: true if transaction exists, false otherwise.

Transaction (struct)

Transaction

[protected]

Transaction class, just a list of operations to be dispatched.

It is defined here so classes derived from TransactionManager can operate, eg sort operations in list, before committing transaction.


Generated by: pavlin on possum.icir.org on Mon Jun 9 13:23:43 2003, using kdoc 2.0a54+XORP.