simpledb.tx.recovery
Class CommitRecord

java.lang.Object
  extended by simpledb.tx.recovery.CommitRecord
All Implemented Interfaces:
LogRecord

 class CommitRecord
extends java.lang.Object
implements LogRecord

The COMMIT log record

Author:
Edward Sciore

Field Summary
 
Fields inherited from interface simpledb.tx.recovery.LogRecord
CHECKPOINT, COMMIT, logMgr, ROLLBACK, SETINT, SETSTRING, START
 
Constructor Summary
CommitRecord(BasicLogRecord rec)
          Creates a log record by reading one other value from the log.
CommitRecord(int txnum)
          Creates a new commit log record for the specified transaction.
 
Method Summary
 int op()
          Returns the log record's type.
 java.lang.String toString()
           
 int txNumber()
          Returns the transaction id stored with the log record.
 void undo(int txnum)
          Does nothing, because a commit record contains no undo information.
 int writeToLog()
          Writes a commit record to the log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommitRecord

public CommitRecord(int txnum)
Creates a new commit log record for the specified transaction.

Parameters:
txnum - the ID of the specified transaction

CommitRecord

public CommitRecord(BasicLogRecord rec)
Creates a log record by reading one other value from the log.

Parameters:
rec - the basic log record
Method Detail

writeToLog

public int writeToLog()
Writes a commit record to the log. This log record contains the COMMIT operator, followed by the transaction id.

Specified by:
writeToLog in interface LogRecord
Returns:
the LSN of the last log value

op

public int op()
Description copied from interface: LogRecord
Returns the log record's type.

Specified by:
op in interface LogRecord
Returns:
the log record's type

txNumber

public int txNumber()
Description copied from interface: LogRecord
Returns the transaction id stored with the log record.

Specified by:
txNumber in interface LogRecord
Returns:
the log record's transaction id

undo

public void undo(int txnum)
Does nothing, because a commit record contains no undo information.

Specified by:
undo in interface LogRecord
Parameters:
txnum - the id of the transaction that is performing the undo.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object