Drizzled Public API Documentation

TransactionManager Class Reference

#include <transaction_manager.h>

List of all members.

Public Member Functions

bool store (const drizzled::message::Transaction &transaction)
bool remove (uint64_t trx_id)
bool contains (uint64_t trx_id)
uint32_t getTransactionBufferSize (uint64_t trx_id)
bool getTransactionMessage (drizzled::message::Transaction &transaction, uint64_t trx_id, uint32_t position)

Private Attributes

boost::unordered_map< uint64_t,
MsgBufferType > 
cache

Detailed Description

Simple (example) Transaction message buffer and content manager.

This class groups Transaction messages together by transaction ID and buffers them together in memory. Obviously, this could eat up a lot of memory if you have very large transactions. A more robust implementation would buffer larger transactions to disk rather than memory.

Note:
Once you have a complete transaction and have processed it, you should call remove() to remove the cache contents for that transaction from memory.

Definition at line 49 of file transaction_manager.h.


Member Function Documentation

bool TransactionManager::contains ( uint64_t  trx_id)

Check to see if any Transaction messages exist for a given transaction.

Parameters:
[in]trx_idThe transaction ID to check for.
Return values:
trueTransaction messages exist
falseNo Transaction messages found

Definition at line 49 of file transaction_manager.cc.

uint32_t TransactionManager::getTransactionBufferSize ( uint64_t  trx_id)

Return number of cached elements for the given transaction ID.

Parameters:
[in]trx_idTransaction ID
Returns:
The number of cached elements associated with trx_id.

Definition at line 59 of file transaction_manager.cc.

bool TransactionManager::getTransactionMessage ( drizzled::message::Transaction transaction,
uint64_t  trx_id,
uint32_t  position 
)

Retrieve a Transaction message from the managed cache.

Caller must supply a Transaction message to populate. The Transaction message to retrieve is indexed by a combination of transaction ID and position.

Parameters:
[out]transactionTransaction message to populate
[in]trx_idTransaction ID
[in]positionIndex into the buffer associated with trx_id
Return values:
trueSuccess
falseFailure

Definition at line 64 of file transaction_manager.cc.

bool TransactionManager::remove ( uint64_t  trx_id)

Clear the buffer contents for a given transaction ID.

Parameters:
[in]trx_idThe transaction ID for the transaction to remove
Return values:
trueSuccess
falseFailure

Definition at line 43 of file transaction_manager.cc.

bool TransactionManager::store ( const drizzled::message::Transaction transaction)

Store the given Transaction message in a buffer.

Parameters:
[in]transactionPointer to the Transaction message to store.
Return values:
trueSuccess
falseFailure

Definition at line 32 of file transaction_manager.cc.


Member Data Documentation

boost::unordered_map<uint64_t,MsgBufferType> TransactionManager::cache [private]

Our message buffer cache, mapped by the transaction ID.

We organize Transactions messages by grouping them by transaction ID, then storing the messages in std::vectors in std::string format. The string format is convenient because it can be easily copied around (GPB messages do not provide deep copying).

Definition at line 118 of file transaction_manager.h.


The documentation for this class was generated from the following files: