public static class FileTxnLog.FileTxnIterator extends Object implements TxnLog.TxnIterator
| Constructor and Description |
|---|
FileTxnIterator(File logDir,
long zxid)
create an iterator over a transaction database directory
|
FileTxnIterator(File logDir,
long zxid,
boolean fastForward)
create an iterator over a transaction database directory
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close the iterator
and release the resources.
|
protected InputArchive |
createInputArchive(File logFile)
Invoked to indicate that the input stream has been created.
|
TxnDigest |
getDigest() |
TxnHeader |
getHeader()
return the current header
|
long |
getStorageSize()
Return total storage size of txnlog that will return by this iterator.
|
Record |
getTxn()
return the current transaction
|
protected void |
inStreamCreated(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
|
public FileTxnIterator(File logDir, long zxid, boolean fastForward) throws IOException
logDir - the transaction database directoryzxid - the zxid to start reading fromfastForward - true if the iterator should be fast forwarded to
point to the txn of a given zxid, else the iterator will
point to the starting txn of a txnlog that may contain txn of
a given zxidIOExceptionpublic FileTxnIterator(File logDir, long zxid) throws IOException
logDir - the transaction database directoryzxid - the zxid to start reading fromIOExceptionpublic long getStorageSize()
getStorageSize in interface TxnLog.TxnIteratorprotected void inStreamCreated(InputArchive ia, InputStream is) throws IOException
ia - the inputarchive to be read fromis - the inputstreamIOExceptionprotected InputArchive createInputArchive(File logFile) throws IOException
logFile - the file to read.IOExceptionprotected Checksum makeChecksumAlgorithm()
public boolean next()
throws IOException
next in interface TxnLog.TxnIteratorIOExceptionpublic TxnHeader getHeader()
getHeader in interface TxnLog.TxnIteratorpublic Record getTxn()
getTxn in interface TxnLog.TxnIteratorpublic TxnDigest getDigest()
getDigest in interface TxnLog.TxnIteratorpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface TxnLog.TxnIteratorIOExceptionCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.