Package org.apache.hadoop.hbase.io.hfile
Class HFileReaderImpl.EncodedScanner
java.lang.Object
org.apache.hadoop.hbase.io.hfile.HFileReaderImpl.HFileScannerImpl
org.apache.hadoop.hbase.io.hfile.HFileReaderImpl.EncodedScanner
- All Implemented Interfaces:
Closeable,AutoCloseable,HFileScanner,Shipper
- Enclosing class:
- HFileReaderImpl
Scanner that operates on encoded data blocks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataBlockEncoderprivate final HFileBlockDecodingContextprivate final DataBlockEncoder.EncodedSeekerFields inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderImpl.HFileScannerImpl
cacheBlocks, curBlock, isCompaction, nextIndexedKey, pair, pread, prevBlocks, reader -
Constructor Summary
ConstructorsConstructorDescriptionEncodedScanner(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction, HFileContext meta, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidintcompareKey(CellComparator comparator, ExtendedCell key) getCell()Returns Instance ofExtendedCell.private ByteBuffgetEncodedBuffer(HFileBlock newBlock) protected ExtendedCellgetFirstKeyCellInBlock(HFileBlock curBlock) getKey()Gets the current key in the form of a cell.getValue()Gets a buffer view to the current value.booleanisSeeked()protected intloadBlockAndSeekToKey(HFileBlock seekToBlock, ExtendedCell nextIndexedKey, boolean rewind, ExtendedCell key, boolean seekBefore) booleannext()Go to the next key/value in the block section.protected booleanvoidprotected voidupdateCurrentBlock(HFileBlock newBlock) Updates the current block to be the givenHFileBlock.Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderImpl.HFileScannerImpl
assertSeeked, blockSeek, checkKeyLen, checkKeyValueLen, checkLen, close, getCurBlock, getEffectiveDataBlockEncoding, getNextIndexedKey, getReader, readAndUpdateNewBlock, readKeyValueLen, readMvccVersion, readNextDataBlock, recordBlockSize, releaseIfNotCurBlock, reseekTo, reset, seekBefore, seekTo, seekTo, seekTo, shipped, toString, updateCurrBlockRef
-
Field Details
-
decodingCtx
-
seeker
-
dataBlockEncoder
-
-
Constructor Details
-
EncodedScanner
public EncodedScanner(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction, HFileContext meta, org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
isSeeked
- Specified by:
isSeekedin interfaceHFileScanner- Overrides:
isSeekedin classHFileReaderImpl.HFileScannerImpl- Returns:
- True is scanner has had one of the seek calls invoked; i.e.
HFileScanner.seekBefore(ExtendedCell)orHFileScanner.seekTo()orHFileScanner.seekTo(ExtendedCell). Otherwise returns false.
-
setNonSeekedState
- Overrides:
setNonSeekedStatein classHFileReaderImpl.HFileScannerImpl
-
updateCurrentBlock
Updates the current block to be the givenHFileBlock. Seeks to the the first key/value pair.- Overrides:
updateCurrentBlockin classHFileReaderImpl.HFileScannerImpl- Parameters:
newBlock- the block to make current, and read byHFileReaderImpl.readBlock(long, long, boolean, boolean, boolean, boolean, org.apache.hadoop.hbase.io.hfile.BlockType, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding), it's a totally new block with new allocatedByteBuff, so if no further reference to this block, we should release it carefully.- Throws:
CorruptHFileException
-
getEncodedBuffer
-
processFirstDataBlock
- Overrides:
processFirstDataBlockin classHFileReaderImpl.HFileScannerImpl- Throws:
IOException
-
next
Description copied from class:HFileReaderImpl.HFileScannerImplGo to the next key/value in the block section. Loads the next block if necessary. If successful,HFileReaderImpl.HFileScannerImpl.getKey()andHFileReaderImpl.HFileScannerImpl.getValue()can be called.- Specified by:
nextin interfaceHFileScanner- Overrides:
nextin classHFileReaderImpl.HFileScannerImpl- Returns:
- true if successfully navigated to the next key/value
- Throws:
IOException
-
getKey
Description copied from interface:HFileScannerGets the current key in the form of a cell. You must callHFileScanner.seekTo(ExtendedCell)before this method.- Specified by:
getKeyin interfaceHFileScanner- Overrides:
getKeyin classHFileReaderImpl.HFileScannerImpl- Returns:
- gets the current key as a Cell.
-
getValue
Description copied from interface:HFileScannerGets a buffer view to the current value. You must callHFileScanner.seekTo(ExtendedCell)before this method.- Specified by:
getValuein interfaceHFileScanner- Overrides:
getValuein classHFileReaderImpl.HFileScannerImpl- Returns:
- byte buffer for the value. The limit is set to the value size, and the position is 0, the start of the buffer view.
-
getCell
Description copied from interface:HFileScannerReturns Instance ofExtendedCell.- Specified by:
getCellin interfaceHFileScanner- Overrides:
getCellin classHFileReaderImpl.HFileScannerImpl
-
assertValidSeek
-
getFirstKeyCellInBlock
- Overrides:
getFirstKeyCellInBlockin classHFileReaderImpl.HFileScannerImpl
-
loadBlockAndSeekToKey
protected int loadBlockAndSeekToKey(HFileBlock seekToBlock, ExtendedCell nextIndexedKey, boolean rewind, ExtendedCell key, boolean seekBefore) throws IOException - Overrides:
loadBlockAndSeekToKeyin classHFileReaderImpl.HFileScannerImpl- Throws:
IOException
-
compareKey
- Overrides:
compareKeyin classHFileReaderImpl.HFileScannerImpl
-