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
Modifier and TypeFieldDescriptionprivate final DataBlockEncoder
private final HFileBlockDecodingContext
private final DataBlockEncoder.EncodedSeeker
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileReaderImpl.HFileScannerImpl
cacheBlocks, curBlock, isCompaction, nextIndexedKey, pair, pread, prevBlocks, reader
-
Constructor Summary
ConstructorDescriptionEncodedScanner
(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction, HFileContext meta, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
int
compareKey
(CellComparator comparator, ExtendedCell key) getCell()
Returns Instance ofExtendedCell
.private ByteBuff
getEncodedBuffer
(HFileBlock newBlock) protected ExtendedCell
getFirstKeyCellInBlock
(HFileBlock curBlock) getKey()
Gets the current key in the form of a cell.getValue()
Gets a buffer view to the current value.boolean
isSeeked()
protected int
loadBlockAndSeekToKey
(HFileBlock seekToBlock, ExtendedCell nextIndexedKey, boolean rewind, ExtendedCell key, boolean seekBefore) boolean
next()
Go to the next key/value in the block section.protected boolean
void
protected void
updateCurrentBlock
(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:
isSeeked
in interfaceHFileScanner
- Overrides:
isSeeked
in 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:
setNonSeekedState
in classHFileReaderImpl.HFileScannerImpl
-
updateCurrentBlock
Updates the current block to be the givenHFileBlock
. Seeks to the the first key/value pair.- Overrides:
updateCurrentBlock
in 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:
processFirstDataBlock
in classHFileReaderImpl.HFileScannerImpl
- Throws:
IOException
-
next
Description copied from class:HFileReaderImpl.HFileScannerImpl
Go 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:
next
in interfaceHFileScanner
- Overrides:
next
in classHFileReaderImpl.HFileScannerImpl
- Returns:
- true if successfully navigated to the next key/value
- Throws:
IOException
-
getKey
Description copied from interface:HFileScanner
Gets the current key in the form of a cell. You must callHFileScanner.seekTo(ExtendedCell)
before this method.- Specified by:
getKey
in interfaceHFileScanner
- Overrides:
getKey
in classHFileReaderImpl.HFileScannerImpl
- Returns:
- gets the current key as a Cell.
-
getValue
Description copied from interface:HFileScanner
Gets a buffer view to the current value. You must callHFileScanner.seekTo(ExtendedCell)
before this method.- Specified by:
getValue
in interfaceHFileScanner
- Overrides:
getValue
in 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:HFileScanner
Returns Instance ofExtendedCell
.- Specified by:
getCell
in interfaceHFileScanner
- Overrides:
getCell
in classHFileReaderImpl.HFileScannerImpl
-
assertValidSeek
-
getFirstKeyCellInBlock
- Overrides:
getFirstKeyCellInBlock
in classHFileReaderImpl.HFileScannerImpl
-
loadBlockAndSeekToKey
protected int loadBlockAndSeekToKey(HFileBlock seekToBlock, ExtendedCell nextIndexedKey, boolean rewind, ExtendedCell key, boolean seekBefore) throws IOException - Overrides:
loadBlockAndSeekToKey
in classHFileReaderImpl.HFileScannerImpl
- Throws:
IOException
-
compareKey
- Overrides:
compareKey
in classHFileReaderImpl.HFileScannerImpl
-