org.apache.zookeeper.server.persistence
Class FileTxnLog.FileTxnIterator

java.lang.Object
  extended by org.apache.zookeeper.server.persistence.FileTxnLog.FileTxnIterator
All Implemented Interfaces:
TxnLog.TxnIterator
Enclosing class:
FileTxnLog

public static class FileTxnLog.FileTxnIterator
extends Object
implements TxnLog.TxnIterator

this class implements the txnlog iterator interface which is used for reading the transaction logs


Constructor Summary
FileTxnLog.FileTxnIterator(File logDir, long zxid)
          create an iterator over a transaction database directory
 
Method Summary
 void close()
          close the iterator and release the resources.
protected  org.apache.jute.InputArchive createInputArchive(File logFile)
          Invoked to indicate that the input stream has been created.
 TxnHeader getHeader()
          reutrn the current header
 org.apache.jute.Record getTxn()
          return the current transaction
protected  void inStreamCreated(org.apache.jute.InputArchive ia, InputStream is)
          read the header from the inputarchive
protected  Checksum makeChecksumAlgorithm()
          create a checksum algorithm
 boolean next()
          the iterator that moves to the next transaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTxnLog.FileTxnIterator

public FileTxnLog.FileTxnIterator(File logDir,
                                  long zxid)
                           throws IOException
create an iterator over a transaction database directory

Parameters:
logDir - the transaction database directory
zxid - the zxid to start reading from
Throws:
IOException
Method Detail

inStreamCreated

protected void inStreamCreated(org.apache.jute.InputArchive ia,
                               InputStream is)
                        throws IOException
read the header from the inputarchive

Parameters:
ia - the inputarchive to be read from
is - the inputstream
Throws:
IOException

createInputArchive

protected org.apache.jute.InputArchive createInputArchive(File logFile)
                                                   throws IOException
Invoked to indicate that the input stream has been created.

Parameters:
ia - input archive
is - file input stream associated with the input archive.
Throws:
IOException

makeChecksumAlgorithm

protected Checksum makeChecksumAlgorithm()
create a checksum algorithm

Returns:
the checksum algorithm

next

public boolean next()
             throws IOException
the iterator that moves to the next transaction

Specified by:
next in interface TxnLog.TxnIterator
Returns:
true if there is more transactions to be read false if not.
Throws:
IOException

getHeader

public TxnHeader getHeader()
reutrn the current header

Specified by:
getHeader in interface TxnLog.TxnIterator
Returns:
the current header that is read

getTxn

public org.apache.jute.Record getTxn()
return the current transaction

Specified by:
getTxn in interface TxnLog.TxnIterator
Returns:
the current transaction that is read

close

public void close()
           throws IOException
close the iterator and release the resources.

Specified by:
close in interface TxnLog.TxnIterator
Throws:
IOException


Copyright © 2011 The Apache Software Foundation