|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.kernel.impl.transaction.TxLog
public class TxLog
This class is made public for testing purposes only, do not use.
The TxManager uses this class to keep a transaction log for
transaction recovery.
| Nested Class Summary | |
|---|---|
static class |
TxLog.Record
Made public for testing only. |
| Field Summary | |
|---|---|
static byte |
BRANCH_ADD
|
static byte |
MARK_COMMIT
|
static byte |
TX_DONE
|
static byte |
TX_START
|
| Constructor Summary | |
|---|---|
TxLog(String fileName)
Initializes a transaction log using filename. |
|
| Method Summary | |
|---|---|
void |
addBranch(byte[] globalId,
byte[] branchId)
Writes a BRANCH_ADD record to the file. |
void |
close()
Closes the file representing the transaction log. |
void |
force()
Forces the log file (with metadata). |
Iterator<List<TxLog.Record>> |
getDanglingRecords()
Returns an array of lists, each list contains dangling records (transactions that han't been completed yet) grouped after global by transaction id. |
String |
getName()
Returns the name of the transaction log. |
int |
getRecordCount()
Returns the number of records (one of TX_START,BRANCH_ADD,MARK_COMMIT or TX_DONE) written since this instance was created or truncated. |
void |
markAsCommitting(byte[] globalId)
Writes a MARK_COMMIT record to the file and forces the
file to disk. |
void |
switchToLogFile(String newFile)
Switches log file. |
void |
truncate()
Truncates the file to zero size and sets the record count to zero. |
void |
txDone(byte[] globalId)
Writes a TX_DONE record to the file. |
void |
txStart(byte[] globalId)
Writes a TX_START record to the file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte TX_START
public static final byte BRANCH_ADD
public static final byte MARK_COMMIT
public static final byte TX_DONE
| Constructor Detail |
|---|
public TxLog(String fileName)
throws IOException
filename. If the file
isn't empty the position will be set to size of file so new records will
be appended.
fileName - Filename of file to use
IOException - If unable to open file| Method Detail |
|---|
public String getName()
public int getRecordCount()
public void close()
throws IOException
IOException
public void force()
throws IOException
IOException
public void truncate()
throws IOException
IOException
public void txStart(byte[] globalId)
throws IOException
TX_START record to the file.
globalId - The global id of the new transaction
IOException - If unable to write
public void addBranch(byte[] globalId,
byte[] branchId)
throws IOException
BRANCH_ADD record to the file.
globalId - The global id of the transactionbranchId - The branch id for the enlisted resource
IOException - If unable to write
public void markAsCommitting(byte[] globalId)
throws IOException
MARK_COMMIT record to the file and forces the
file to disk.
globalId - The global id of the transaction
IOException - If unable to write
public void txDone(byte[] globalId)
throws IOException
TX_DONE record to the file.
globalId - The global id of the transaction completed
IOException - If unable to write
public Iterator<List<TxLog.Record>> getDanglingRecords()
throws IOException
IOException
public void switchToLogFile(String newFile)
throws IOException
newFile and the makes the switch closing the old log file.
newFile - The filename of the new file to switch to
IOException - If unable to switch log file
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||