|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.log.FileReader
public abstract class FileReader
A FileReader is an abstract class that traverses the log files, reading in chunks of the file at a time. Concrete subclasses perform a particular action to each entry.
Field Summary | |
---|---|
protected boolean |
anticipateChecksumErrors
|
protected ChecksumValidator |
cksumValidator
|
protected LogEntryHeader |
currentEntryHeader
|
protected long |
currentEntryOffset
|
protected long |
currentEntryPrevOffset
|
protected EnvironmentImpl |
envImpl
|
protected boolean |
eof
|
protected FileManager |
fileManager
|
protected long |
nextEntryOffset
|
protected long |
readBufferFileEnd
|
protected long |
readBufferFileNum
|
protected long |
readBufferFileStart
|
protected long |
startLsn
|
Constructor Summary | |
---|---|
FileReader(EnvironmentImpl envImpl,
int readBufferSize,
boolean forward,
long startLsn,
java.lang.Long singleFileNumber,
long endOfFileLsn,
long finishLsn)
A FileReader just needs to know what size chunks to read in. |
Method Summary | |
---|---|
int |
getAndResetNReads()
Returns the number of reads since the last time this method was called. |
int |
getLastEntrySize()
Returns the total size (including header) of the last entry read. |
long |
getLastLsn()
Get LSN of the last entry read. |
long |
getNRepeatIteratorReads()
|
int |
getNumRead()
|
protected void |
initStartingPosition(long endOfFileLsn,
java.lang.Long ignoreSingleFileNumber)
Helper for determining the starting position and opening up a file at the desired location. |
protected boolean |
isTargetEntry(byte logEntryTypeNumber,
byte logEntryTypeVersion)
|
protected abstract boolean |
processEntry(java.nio.ByteBuffer entryBuffer)
Each file reader implements this method to process the entry data. |
(package private) void |
readEntry(LogEntry entry,
java.nio.ByteBuffer buffer,
boolean readFullItem)
A bottleneck for all calls to LogEntry.readEntry. |
boolean |
readNextEntry()
readNextEntry scans the log files until either it's reached the end of the log or has hit an invalid portion. |
protected boolean |
resyncReader(long nextGoodRecordPostCorruption,
boolean dumpCorruptedBounds)
|
void |
setAlwaysValidateChecksum(boolean validate)
Whether to always validate the checksum, even for non-target entries. |
(package private) java.nio.Buffer |
threadSafeBufferPosition(java.nio.ByteBuffer buffer,
int newPosition)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected EnvironmentImpl envImpl
protected FileManager fileManager
protected boolean eof
protected long readBufferFileNum
protected long readBufferFileStart
protected long readBufferFileEnd
protected LogEntryHeader currentEntryHeader
protected long currentEntryPrevOffset
protected long currentEntryOffset
protected long nextEntryOffset
protected long startLsn
protected ChecksumValidator cksumValidator
protected boolean anticipateChecksumErrors
Constructor Detail |
---|
public FileReader(EnvironmentImpl envImpl, int readBufferSize, boolean forward, long startLsn, java.lang.Long singleFileNumber, long endOfFileLsn, long finishLsn) throws java.io.IOException, DatabaseException
endOfFileLsn
- indicates the end of the log file
java.io.IOException
DatabaseException
Method Detail |
---|
protected void initStartingPosition(long endOfFileLsn, java.lang.Long ignoreSingleFileNumber) throws java.io.IOException, DatabaseException
java.io.IOException
DatabaseException
public void setAlwaysValidateChecksum(boolean validate)
public int getNumRead()
public long getNRepeatIteratorReads()
public long getLastLsn()
public int getLastEntrySize()
void readEntry(LogEntry entry, java.nio.ByteBuffer buffer, boolean readFullItem) throws DatabaseException
DatabaseException
public boolean readNextEntry() throws DatabaseException, java.io.IOException
DatabaseException
java.io.IOException
protected boolean resyncReader(long nextGoodRecordPostCorruption, boolean dumpCorruptedBounds) throws DatabaseException, java.io.IOException
DatabaseException
java.io.IOException
public int getAndResetNReads()
protected boolean isTargetEntry(byte logEntryTypeNumber, byte logEntryTypeVersion) throws DatabaseException
DatabaseException
protected abstract boolean processEntry(java.nio.ByteBuffer entryBuffer) throws DatabaseException
enteryBuffer
- contains the entry data and is positioned at the
data
DatabaseException
java.nio.Buffer threadSafeBufferPosition(java.nio.ByteBuffer buffer, int newPosition)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |