Package org.iq80.leveldb.impl
Class LogReader
java.lang.Object
org.iq80.leveldb.impl.LogReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SliceOutputScratch buffer for current block.private SliceInputThe current block records are being read from.private SliceCurrent chunk which is sliced from the current block.private longOffset of the first location past the end of buffer.private booleanHave we read to the end of the file?private final FileChannelprivate final longOffset at which to start looking for the first record to returnprivate longOffset of the last record returned by readRecord.private final LogMonitorprivate final DynamicSliceOutputScratch buffer in which the next record is assembled.private final boolean -
Constructor Summary
ConstructorsConstructorDescriptionLogReader(FileChannel fileChannel, LogMonitor monitor, boolean verifyChecksums, long initialOffset) -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanprivate LogChunkTypeReturn type, or one of the preceding special valuesprivate voidreportCorruption(long bytes, String reason) Reports corruption to the monitor.private voidreportDrop(long bytes, Throwable reason) Reports dropped bytes to the monitor.private booleanSkips all blocks that are completely before "initial_offset_".
-
Field Details
-
fileChannel
-
monitor
-
verifyChecksums
private final boolean verifyChecksums -
initialOffset
private final long initialOffsetOffset at which to start looking for the first record to return -
eof
private boolean eofHave we read to the end of the file? -
lastRecordOffset
private long lastRecordOffsetOffset of the last record returned by readRecord. -
endOfBufferOffset
private long endOfBufferOffsetOffset of the first location past the end of buffer. -
recordScratch
Scratch buffer in which the next record is assembled. -
blockScratch
Scratch buffer for current block. The currentBlock is sliced off the underlying buffer. -
currentBlock
The current block records are being read from. -
currentChunk
Current chunk which is sliced from the current block.
-
-
Constructor Details
-
LogReader
public LogReader(FileChannel fileChannel, LogMonitor monitor, boolean verifyChecksums, long initialOffset)
-
-
Method Details
-
getLastRecordOffset
public long getLastRecordOffset() -
skipToInitialBlock
private boolean skipToInitialBlock()Skips all blocks that are completely before "initial_offset_". Handles reporting corruption- Returns:
- true on success.
-
readRecord
-
readNextChunk
Return type, or one of the preceding special values -
readNextBlock
public boolean readNextBlock() -
reportCorruption
Reports corruption to the monitor. The buffer must be updated to remove the dropped bytes prior to invocation. -
reportDrop
Reports dropped bytes to the monitor. The buffer must be updated to remove the dropped bytes prior to invocation.
-