org.neo4j.kernel.impl.transaction.xaframework
Class LogBackedXaDataSource

java.lang.Object
  extended by org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
      extended by org.neo4j.kernel.impl.transaction.xaframework.LogBackedXaDataSource
Direct Known Subclasses:
LuceneDataSource, NeoStoreXaDataSource

public abstract class LogBackedXaDataSource
extends XaDataSource


Constructor Summary
LogBackedXaDataSource(Map<?,?> params)
           
 
Method Summary
 boolean deleteLogicalLog(long version)
          Deletes a log specific logical log.
 String getFileName(long version)
           
 LogExtractor getLogExtractor(long startTxId, long endTxIdHint)
           
 ReadableByteChannel getLogicalLog(long version)
          Returns a readable byte channel of the specified logical log.
 long getLogicalLogLength(long version)
           
 Pair<Integer,Long> getMasterForCommittedTx(long txId)
           
 ReadableByteChannel getPreparedTransaction(int identifier)
           
 void getPreparedTransaction(int identifier, LogBuffer targetBuffer)
           
 boolean hasLogicalLog(long version)
          Tests if a specific logical log exists.
 boolean isLogicalLogKept()
           
 void keepLogicalLogs(boolean keepLogs)
          Sets wether logical logs should be saved upon rotation or not.
 long rotateLogicalLog()
          Rotates this logical log.
 void setAutoRotate(boolean rotate)
          Turns off/on auto rotate of logical logs.
protected  void setKeepLogicalLogsIfSpecified(String configString, String dataSourceName)
           
protected  void setLogicalLogAtCreationTime(XaLogicalLog logicalLog)
          Sets the XaLogicalLog at creation time (in constructor).
 void setLogicalLogTargetSize(long size)
          Sets the target size of the logical log that will cause a rotation of the log if XaDataSource.setAutoRotate(boolean) is set to true.
 
Methods inherited from class org.neo4j.kernel.impl.transaction.xaframework.XaDataSource
applyCommittedTransaction, applyPreparedTransaction, close, getBranchId, getCreationTime, getCurrentLogVersion, getLastCommittedTxId, getName, getRandomIdentifier, getXaConnection, getXaContainer, listStoreFiles, setBranchId, setLastCommittedTxId, setName, setRecovered, shouldKeepLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogBackedXaDataSource

public LogBackedXaDataSource(Map<?,?> params)
                      throws InstantiationException
Throws:
InstantiationException
Method Detail

setLogicalLogAtCreationTime

protected void setLogicalLogAtCreationTime(XaLogicalLog logicalLog)
Sets the XaLogicalLog at creation time (in constructor). It is done with this method because it can be so problematic in so many ways to have a subclass pass in this to the constructor.

Parameters:
logicalLog - the XaLogicalLog to set.

deleteLogicalLog

public boolean deleteLogicalLog(long version)
Description copied from class: XaDataSource
Deletes a log specific logical log.

Overrides:
deleteLogicalLog in class XaDataSource
Parameters:
version - version of log to delete
Returns:
true if the log existed and was deleted

getLogicalLog

public ReadableByteChannel getLogicalLog(long version)
                                  throws IOException
Description copied from class: XaDataSource
Returns a readable byte channel of the specified logical log.

Overrides:
getLogicalLog in class XaDataSource
Parameters:
version - version of the logical log
Returns:
readable byte channel of the logical log
Throws:
IOException - if no such log exist

getLogicalLogLength

public long getLogicalLogLength(long version)
Overrides:
getLogicalLogLength in class XaDataSource

hasLogicalLog

public boolean hasLogicalLog(long version)
Description copied from class: XaDataSource
Tests if a specific logical log exists.

Overrides:
hasLogicalLog in class XaDataSource
Parameters:
version - the version of the logical log
Returns:
true if the log exists

isLogicalLogKept

public boolean isLogicalLogKept()
Overrides:
isLogicalLogKept in class XaDataSource

keepLogicalLogs

public void keepLogicalLogs(boolean keepLogs)
Description copied from class: XaDataSource
Sets wether logical logs should be saved upon rotation or not. Default is false.

Overrides:
keepLogicalLogs in class XaDataSource
Parameters:
keepLogs - true means save, false means delete

rotateLogicalLog

public long rotateLogicalLog()
                      throws IOException
Description copied from class: XaDataSource
Rotates this logical log. If XaDataSource.keepLogicalLogs(boolean) is configured to true the log will be saved and can be retrieved with the XaDataSource.getLogicalLog(long) method. If not it will be deleted. Active transactions get copied to a new logical log.

Overrides:
rotateLogicalLog in class XaDataSource
Throws:
IOException - if unable to read old log or write to new one

setAutoRotate

public void setAutoRotate(boolean rotate)
Description copied from class: XaDataSource
Turns off/on auto rotate of logical logs. Default is true.

Overrides:
setAutoRotate in class XaDataSource
Parameters:
rotate - true to turn on

setLogicalLogTargetSize

public void setLogicalLogTargetSize(long size)
Description copied from class: XaDataSource
Sets the target size of the logical log that will cause a rotation of the log if XaDataSource.setAutoRotate(boolean) is set to true.

Overrides:
setLogicalLogTargetSize in class XaDataSource
Parameters:
size - target size in bytes

getFileName

public String getFileName(long version)
Overrides:
getFileName in class XaDataSource

getPreparedTransaction

public ReadableByteChannel getPreparedTransaction(int identifier)
                                           throws IOException
Overrides:
getPreparedTransaction in class XaDataSource
Throws:
IOException

getPreparedTransaction

public void getPreparedTransaction(int identifier,
                                   LogBuffer targetBuffer)
                            throws IOException
Overrides:
getPreparedTransaction in class XaDataSource
Throws:
IOException

getMasterForCommittedTx

public Pair<Integer,Long> getMasterForCommittedTx(long txId)
                                           throws IOException
Overrides:
getMasterForCommittedTx in class XaDataSource
Throws:
IOException

getLogExtractor

public LogExtractor getLogExtractor(long startTxId,
                                    long endTxIdHint)
                             throws IOException
Overrides:
getLogExtractor in class XaDataSource
Throws:
IOException

setKeepLogicalLogsIfSpecified

protected void setKeepLogicalLogsIfSpecified(String configString,
                                             String dataSourceName)


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.