public abstract class FileReader
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
protected abstract boolean |
processEntry(java.nio.ByteBuffer entryBuffer)
Each file reader implements this method to process the entry data.
|
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) int |
threadSafeBufferPosition(java.nio.ByteBuffer buffer) |
(package private) java.nio.Buffer |
threadSafeBufferPosition(java.nio.ByteBuffer buffer,
int newPosition) |
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
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 filejava.io.IOExceptionDatabaseExceptionprotected void initStartingPosition(long endOfFileLsn,
java.lang.Long ignoreSingleFileNumber)
throws java.io.IOException,
DatabaseException
java.io.IOExceptionDatabaseExceptionpublic void setAlwaysValidateChecksum(boolean validate)
public int getNumRead()
public long getNRepeatIteratorReads()
public long getLastLsn()
public int getLastEntrySize()
public boolean readNextEntry()
throws DatabaseException,
java.io.IOException
DatabaseExceptionjava.io.IOExceptionprotected boolean resyncReader(long nextGoodRecordPostCorruption,
boolean dumpCorruptedBounds)
throws DatabaseException,
java.io.IOException
DatabaseExceptionjava.io.IOExceptionpublic int getAndResetNReads()
protected boolean isTargetEntry()
throws DatabaseException
DatabaseExceptionprotected abstract boolean processEntry(java.nio.ByteBuffer entryBuffer)
throws DatabaseException
enteryBuffer - contains the entry data and is positioned at the
dataDatabaseExceptionint threadSafeBufferPosition(java.nio.ByteBuffer buffer)
java.nio.Buffer threadSafeBufferPosition(java.nio.ByteBuffer buffer,
int newPosition)
Copyright (c) 2004,2008 Oracle. All rights reserved.