protected static class HFileReaderImpl.EncodedScanner extends HFileReaderImpl.HFileScannerImpl
Modifier and Type | Field and Description |
---|---|
private DataBlockEncoder |
dataBlockEncoder |
private HFileBlockDecodingContext |
decodingCtx |
private DataBlockEncoder.EncodedSeeker |
seeker |
cacheBlocks, curBlock, isCompaction, nextIndexedKey, pair, pread, prevBlocks, reader
Constructor and Description |
---|
EncodedScanner(HFile.Reader reader,
boolean cacheBlocks,
boolean pread,
boolean isCompaction,
HFileContext meta) |
Modifier and Type | Method and Description |
---|---|
private void |
assertValidSeek() |
int |
compareKey(CellComparator comparator,
Cell key) |
Cell |
getCell() |
private ByteBuff |
getEncodedBuffer(HFileBlock newBlock) |
protected Cell |
getFirstKeyCellInBlock(HFileBlock curBlock) |
Cell |
getKey()
Gets the current key in the form of a cell.
|
String |
getKeyString()
Convenience method to get a copy of the key as a string - interpreting the
bytes as UTF8.
|
ByteBuffer |
getValue()
Gets a buffer view to the current value.
|
String |
getValueString()
Convenience method to get a copy of the value as a string - interpreting
the bytes as UTF8.
|
boolean |
isSeeked() |
protected int |
loadBlockAndSeekToKey(HFileBlock seekToBlock,
Cell nextIndexedKey,
boolean rewind,
Cell key,
boolean seekBefore) |
boolean |
next()
Go to the next key/value in the block section.
|
protected boolean |
processFirstDataBlock() |
void |
setNonSeekedState() |
protected void |
updateCurrentBlock(HFileBlock newBlock)
Updates the current block to be the given
HFileBlock . |
assertSeeked, blockSeek, checkKeyLen, checkKeyValueLen, checkLen, close, getEffectiveDataBlockEncoding, getNextIndexedKey, getReader, readAndUpdateNewBlock, readKeyValueLen, readMvccVersion, readNextDataBlock, releaseIfNotCurBlock, reseekTo, reset, seekBefore, seekTo, seekTo, seekTo, shipped, toString, updateCurrBlockRef
private final HFileBlockDecodingContext decodingCtx
private final DataBlockEncoder.EncodedSeeker seeker
private final DataBlockEncoder dataBlockEncoder
public EncodedScanner(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction, HFileContext meta)
public boolean isSeeked()
isSeeked
in interface HFileScanner
isSeeked
in class HFileReaderImpl.HFileScannerImpl
HFileScanner.seekBefore(Cell)
or HFileScanner.seekTo()
or HFileScanner.seekTo(Cell)
.
Otherwise returns false.public void setNonSeekedState()
setNonSeekedState
in class HFileReaderImpl.HFileScannerImpl
protected void updateCurrentBlock(HFileBlock newBlock) throws CorruptHFileException
HFileBlock
. Seeks to the the first
key/value pair.updateCurrentBlock
in class HFileReaderImpl.HFileScannerImpl
newBlock
- the block to make current, and read by HFileReaderImpl.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 allocated ByteBuff
, so if no further
reference to this block, we should release it carefully.CorruptHFileException
private ByteBuff getEncodedBuffer(HFileBlock newBlock)
protected boolean processFirstDataBlock() throws IOException
processFirstDataBlock
in class HFileReaderImpl.HFileScannerImpl
IOException
public boolean next() throws IOException
HFileReaderImpl.HFileScannerImpl
HFileReaderImpl.HFileScannerImpl.getKey()
and HFileReaderImpl.HFileScannerImpl.getValue()
can
be called.next
in interface HFileScanner
next
in class HFileReaderImpl.HFileScannerImpl
IOException
public Cell getKey()
HFileScanner
HFileScanner.seekTo(Cell)
before this method.getKey
in interface HFileScanner
getKey
in class HFileReaderImpl.HFileScannerImpl
public ByteBuffer getValue()
HFileScanner
HFileScanner.seekTo(Cell)
before this method.getValue
in interface HFileScanner
getValue
in class HFileReaderImpl.HFileScannerImpl
public Cell getCell()
getCell
in interface HFileScanner
getCell
in class HFileReaderImpl.HFileScannerImpl
Cell
.public String getKeyString()
HFileScanner
HFileScanner.seekTo(Cell)
before this method.getKeyString
in interface HFileScanner
getKeyString
in class HFileReaderImpl.HFileScannerImpl
public String getValueString()
HFileScanner
HFileScanner.seekTo(Cell)
before this method.getValueString
in interface HFileScanner
getValueString
in class HFileReaderImpl.HFileScannerImpl
private void assertValidSeek()
protected Cell getFirstKeyCellInBlock(HFileBlock curBlock)
getFirstKeyCellInBlock
in class HFileReaderImpl.HFileScannerImpl
protected int loadBlockAndSeekToKey(HFileBlock seekToBlock, Cell nextIndexedKey, boolean rewind, Cell key, boolean seekBefore) throws IOException
loadBlockAndSeekToKey
in class HFileReaderImpl.HFileScannerImpl
IOException
public int compareKey(CellComparator comparator, Cell key)
compareKey
in class HFileReaderImpl.HFileScannerImpl
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.