org.tranche.flatfile.logs
Class DiskBackedTransactionLog

java.lang.Object
  extended by org.tranche.flatfile.logs.DiskBackedTransactionLog
All Implemented Interfaces:
DataBlockUtilLog

public class DiskBackedTransactionLog
extends java.lang.Object
implements DataBlockUtilLog

Logs every transaction. Useful for stress testing, but will negatively impact performance due to transaction writes.

Author:
Bryan Smith - bryanesmith@gmail.com

Constructor Summary
DiskBackedTransactionLog(java.io.File logFile)
           
 
Method Summary
 void close()
          Close off resources associated with this log.
 long getBlockGetFailures()
          Uses the default log.
 long getBlockGetSuccesses()
          Uses the default log.
 long getBlockSetFailures()
          Uses the default log.
 long getBlockSetSuccesses()
          Uses the default log.
 java.io.File getLogFile()
          Return the file used by the log.
 long getRuntime()
          Uses the default log.
 long getTimeSpentMerging()
          Uses the default log.
 void logGetBlockFailed(BigHash hash)
          Log failed get request.
 void logGetBlockSucceed(BigHash hash)
          Log successful get request.
 void logGetStarted(BigHash hash)
          Log start of a get request.
 void logHasFalse(BigHash hash)
          Log does not have a chunk.
 void logHasStarted(BigHash hash)
          Log the start of a has chunk activity.
 void logHasTrue(BigHash hash)
          Log has a chunk.
 void logMergeFinish(java.io.File datablock)
          Log stop of merge.
 void logMergeStart(java.io.File datablock)
          Log start of merge.
 void logSetBlockFailed(BigHash hash)
          Log failed set request.
 void logSetBlockSucceed(BigHash hash)
          Log successful set request.
 void logSetStarted(BigHash hash)
          Log start of a set request.
 void restart()
          Reset resources.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiskBackedTransactionLog

public DiskBackedTransactionLog(java.io.File logFile)
                         throws java.lang.Exception
Parameters:
logFile -
Throws:
java.lang.Exception
Method Detail

restart

public void restart()
             throws java.lang.Exception

Reset resources.

Throws:
java.lang.Exception

getLogFile

public java.io.File getLogFile()

Return the file used by the log.

Returns:

logMergeStart

public void logMergeStart(java.io.File datablock)

Log start of merge.

Specified by:
logMergeStart in interface DataBlockUtilLog
Parameters:
datablock -

logMergeFinish

public void logMergeFinish(java.io.File datablock)

Log stop of merge.

Specified by:
logMergeFinish in interface DataBlockUtilLog
Parameters:
datablock -

logHasStarted

public void logHasStarted(BigHash hash)

Log the start of a has chunk activity.

Specified by:
logHasStarted in interface DataBlockUtilLog
Parameters:
hash -

logHasTrue

public void logHasTrue(BigHash hash)

Log has a chunk.

Specified by:
logHasTrue in interface DataBlockUtilLog
Parameters:
hash -

logHasFalse

public void logHasFalse(BigHash hash)

Log does not have a chunk.

Specified by:
logHasFalse in interface DataBlockUtilLog
Parameters:
hash -

logGetStarted

public void logGetStarted(BigHash hash)

Log start of a get request.

Specified by:
logGetStarted in interface DataBlockUtilLog
Parameters:
hash -

logGetBlockSucceed

public void logGetBlockSucceed(BigHash hash)

Log successful get request.

Specified by:
logGetBlockSucceed in interface DataBlockUtilLog
Parameters:
hash -

logGetBlockFailed

public void logGetBlockFailed(BigHash hash)

Log failed get request.

Specified by:
logGetBlockFailed in interface DataBlockUtilLog
Parameters:
hash -

logSetStarted

public void logSetStarted(BigHash hash)

Log start of a set request.

Specified by:
logSetStarted in interface DataBlockUtilLog
Parameters:
hash -

logSetBlockSucceed

public void logSetBlockSucceed(BigHash hash)

Log successful set request.

Specified by:
logSetBlockSucceed in interface DataBlockUtilLog
Parameters:
hash -

logSetBlockFailed

public void logSetBlockFailed(BigHash hash)

Log failed set request.

Specified by:
logSetBlockFailed in interface DataBlockUtilLog
Parameters:
hash -

getTimeSpentMerging

public long getTimeSpentMerging()

Uses the default log. For more information, call logs directly.

Specified by:
getTimeSpentMerging in interface DataBlockUtilLog
Returns:

getRuntime

public long getRuntime()

Uses the default log. For more information, call logs directly.

Specified by:
getRuntime in interface DataBlockUtilLog
Returns:

toString

public java.lang.String toString()
Specified by:
toString in interface DataBlockUtilLog
Overrides:
toString in class java.lang.Object

getBlockGetSuccesses

public long getBlockGetSuccesses()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockGetSuccesses in interface DataBlockUtilLog
Returns:

getBlockGetFailures

public long getBlockGetFailures()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockGetFailures in interface DataBlockUtilLog
Returns:

getBlockSetSuccesses

public long getBlockSetSuccesses()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockSetSuccesses in interface DataBlockUtilLog
Returns:

getBlockSetFailures

public long getBlockSetFailures()

Uses the default log. For more information, call logs directly.

Specified by:
getBlockSetFailures in interface DataBlockUtilLog
Returns:

close

public void close()
           throws java.lang.Exception

Close off resources associated with this log.

Specified by:
close in interface DataBlockUtilLog
Throws:
java.lang.Exception


This code is free for use both commercially and non-commercially as stated in the project's license