LogicalTxnParticipant Class Reference

LogicalTxnParticipant defines an interface which must be implemented by any object which is to participate in a LogicalTxn. More...

#include <LogicalTxnParticipant.h>

Inheritance diagram for LogicalTxnParticipant:

BTreeWriter DatabaseTest FtrsTableWriter LogicalTxnTest List of all members.

Public Member Functions

virtual ~LogicalTxnParticipant ()
virtual LogicalTxnClassId getParticipantClassId () const=0
 
Returns:
the LogicalTxnClassId for this participant; this will be used during recovery to find the correct LogicalTxnParticipantFactory

virtual void describeParticipant (ByteOutputStream &logStream)=0
 Called by LogicalTxn the first time an action is logged for this participant.
virtual void undoLogicalAction (LogicalActionType actionType, ByteInputStream &logStream)=0
 Performs undo for one logical action during rollback or recovery.
virtual void redoLogicalAction (LogicalActionType actionType, ByteInputStream &logStream)=0
 Performs redo for one logical action during recovery.

Protected Member Functions

 LogicalTxnParticipant ()
LogicalTxngetLogicalTxn ()
 
Returns:
LogicalTxn being participated in, or null if no txn in progress; null is also returned during recovery

bool isLoggingEnabled () const
 
Returns:
true if actions should be logged; this is false during recovery


Private Member Functions

void clearLogicalTxn ()
void enableLogging (bool)

Private Attributes

LogicalTxnpTxn
bool loggingEnabled

Friends

class LogicalTxn

Detailed Description

LogicalTxnParticipant defines an interface which must be implemented by any object which is to participate in a LogicalTxn.

Definition at line 35 of file LogicalTxnParticipant.h.


Constructor & Destructor Documentation

LogicalTxnParticipant::LogicalTxnParticipant (  )  [explicit, protected]

Definition at line 30 of file LogicalTxnParticipant.cpp.

References enableLogging(), and pTxn.

00031 {
00032     enableLogging(false);
00033     pTxn = NULL;
00034 }

LogicalTxnParticipant::~LogicalTxnParticipant (  )  [virtual]

Definition at line 36 of file LogicalTxnParticipant.cpp.

00037 {
00038 }


Member Function Documentation

void LogicalTxnParticipant::clearLogicalTxn (  )  [private]

Definition at line 45 of file LogicalTxnParticipant.cpp.

References enableLogging(), and pTxn.

Referenced by LogicalTxn::forgetAllParticipants().

00046 {
00047     assert(pTxn);
00048     enableLogging(false);
00049     pTxn = NULL;
00050 }

void LogicalTxnParticipant::enableLogging ( bool   )  [private]

Definition at line 40 of file LogicalTxnParticipant.cpp.

References loggingEnabled.

Referenced by clearLogicalTxn(), LogicalTxnParticipant(), and LogicalTxn::rollbackToSavepoint().

00041 {
00042     loggingEnabled = enabled;
00043 }

LogicalTxn * LogicalTxnParticipant::getLogicalTxn (  )  [inline, protected]

Returns:
LogicalTxn being participated in, or null if no txn in progress; null is also returned during recovery

Definition at line 111 of file LogicalTxnParticipant.h.

References pTxn.

Referenced by LogicalTxnTest::commit(), BTreeWriter::deleteCurrent(), FtrsTableWriter::execute(), DatabaseTest::executeIncrementAction(), BTreeWriter::insertTupleFromBuffer(), LogicalTxnTest::rollbackFull(), LogicalTxnTest::testActions(), LogicalTxnTest::testCheckpointCommitSavepoint(), LogicalTxnTest::testRollbackSavepoint(), LogicalTxnTest::testTxn(), and LogicalTxnTest::testTxnIdSequence().

00112 {
00113     return pTxn;
00114 }

bool LogicalTxnParticipant::isLoggingEnabled (  )  const [inline, protected]

Returns:
true if actions should be logged; this is false during recovery

Definition at line 116 of file LogicalTxnParticipant.h.

References loggingEnabled.

Referenced by BTreeWriter::deleteCurrent(), FtrsTableWriter::execute(), BTreeWriter::insertTupleFromBuffer(), and BTreeWriter::updateCurrent().

00117 {
00118     return loggingEnabled;
00119 }

virtual LogicalTxnClassId LogicalTxnParticipant::getParticipantClassId (  )  const [pure virtual]

Returns:
the LogicalTxnClassId for this participant; this will be used during recovery to find the correct LogicalTxnParticipantFactory

Implemented in BTreeWriter, FtrsTableWriter, DatabaseTest, and LogicalTxnTest.

virtual void LogicalTxnParticipant::describeParticipant ( ByteOutputStream logStream  )  [pure virtual]

Called by LogicalTxn the first time an action is logged for this participant.

The participant must implement this by writing a description of itself to the given output stream. This information must be sufficient for reconstructing the participant during recovery.

Parameters:
logStream stream to which the participant description should be written

Implemented in BTreeWriter, FtrsTableWriter, DatabaseTest, and LogicalTxnTest.

virtual void LogicalTxnParticipant::undoLogicalAction ( LogicalActionType  actionType,
ByteInputStream logStream 
) [pure virtual]

Performs undo for one logical action during rollback or recovery.

The implementation must consume ALL log data for this action, even if some of it turns out to be unneeded.

Parameters:
actionType the type of action to undo; the rest of the action parameters should be read from the LogicalTxn's input stream
logStream stream from which to read action data

Implemented in BTreeWriter, FtrsTableWriter, DatabaseTest, and LogicalTxnTest.

Referenced by LogicalRecoveryTxn::undoActions().

virtual void LogicalTxnParticipant::redoLogicalAction ( LogicalActionType  actionType,
ByteInputStream logStream 
) [pure virtual]

Performs redo for one logical action during recovery.

The implementation must consume ALL log data for this action, even if some of it turns out to be unneeded.

Parameters:
actionType the type of action to redo; the rest of the action parameters should be read from the LogicalTxn's input stream
logStream stream from which to read action data

Implemented in BTreeWriter, FtrsTableWriter, DatabaseTest, and LogicalTxnTest.

Referenced by LogicalRecoveryTxn::redoActions().


Friends And Related Function Documentation

friend class LogicalTxn [friend]

Definition at line 37 of file LogicalTxnParticipant.h.


Member Data Documentation

LogicalTxn* LogicalTxnParticipant::pTxn [private]

Definition at line 39 of file LogicalTxnParticipant.h.

Referenced by LogicalTxn::beginLogicalAction(), clearLogicalTxn(), FtrsTableWriter::execute(), DatabaseTest::executeCheckpointedTxn(), DatabaseTest::executeForceTxn(), DatabaseTest::executeIncrementTxn(), getLogicalTxn(), LogicalTxnParticipant(), and LogicalTxnTest::testTxn().

bool LogicalTxnParticipant::loggingEnabled [private]

Definition at line 41 of file LogicalTxnParticipant.h.

Referenced by enableLogging(), and isLoggingEnabled().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:39 2009 for Fennel by  doxygen 1.5.1