Class FileTxnLog.FileTxnIterator
- java.lang.Object
-
- org.apache.zookeeper.server.persistence.FileTxnLog.FileTxnIterator
-
- All Implemented Interfaces:
TxnLog.TxnIterator
- Enclosing class:
- FileTxnLog
public static class FileTxnLog.FileTxnIterator extends java.lang.Object implements TxnLog.TxnIterator
this class implements the txnlog iterator interface which is used for reading the transaction logs
-
-
Constructor Summary
Constructors Constructor Description FileTxnIterator(java.io.File logDir, long zxid)create an iterator over a transaction database directory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()close the iterator and release the resources.protected org.apache.jute.InputArchivecreateInputArchive(java.io.File logFile)Invoked to indicate that the input stream has been created.TxnHeadergetHeader()reutrn the current headerorg.apache.jute.RecordgetTxn()return the current transactionprotected voidinStreamCreated(org.apache.jute.InputArchive ia, java.io.InputStream is)read the header from the inputarchiveprotected java.util.zip.ChecksummakeChecksumAlgorithm()create a checksum algorithmbooleannext()the iterator that moves to the next transaction
-
-
-
Method Detail
-
inStreamCreated
protected void inStreamCreated(org.apache.jute.InputArchive ia, java.io.InputStream is) throws java.io.IOExceptionread the header from the inputarchive- Parameters:
ia- the inputarchive to be read fromis- the inputstream- Throws:
java.io.IOException
-
createInputArchive
protected org.apache.jute.InputArchive createInputArchive(java.io.File logFile) throws java.io.IOExceptionInvoked to indicate that the input stream has been created.- Parameters:
ia- input archiveis- file input stream associated with the input archive.- Throws:
java.io.IOException
-
makeChecksumAlgorithm
protected java.util.zip.Checksum makeChecksumAlgorithm()
create a checksum algorithm- Returns:
- the checksum algorithm
-
next
public boolean next() throws java.io.IOExceptionthe iterator that moves to the next transaction- Specified by:
nextin interfaceTxnLog.TxnIterator- Returns:
- true if there is more transactions to be read false if not.
- Throws:
java.io.IOException
-
getHeader
public TxnHeader getHeader()
reutrn the current header- Specified by:
getHeaderin interfaceTxnLog.TxnIterator- Returns:
- the current header that is read
-
getTxn
public org.apache.jute.Record getTxn()
return the current transaction- Specified by:
getTxnin interfaceTxnLog.TxnIterator- Returns:
- the current transaction that is read
-
close
public void close() throws java.io.IOExceptionclose the iterator and release the resources.- Specified by:
closein interfaceTxnLog.TxnIterator- Throws:
java.io.IOException
-
-