protected static class HFileReaderImpl.HFileScannerImpl extends Object implements HFileScanner
| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicInteger |
blockFetches |
protected boolean |
cacheBlocks |
protected HFileBlock |
curBlock |
protected boolean |
isCompaction |
protected Cell |
nextIndexedKey
The next indexed key is to keep track of the indexed key of the next data block.
|
protected boolean |
pread |
protected ArrayList<HFileBlock> |
prevBlocks |
protected HFile.Reader |
reader |
| 构造器和说明 |
|---|
HFileScannerImpl(HFile.Reader reader,
boolean cacheBlocks,
boolean pread,
boolean isCompaction) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
assertSeeked() |
protected int |
blockSeek(Cell key,
boolean seekBefore)
Within a loaded block, seek looking for the last key that is smaller than
(or equal to?)
|
protected boolean |
checkKeyLen(int v) |
protected void |
checkKeyValueLen()
Check key and value lengths are wholesome.
|
protected boolean |
checkLen(int v) |
void |
close()
Close this HFile scanner and do necessary cleanup.
|
int |
compareKey(CellComparator comparator,
Cell key) |
Cell |
getCell() |
DataBlockEncoding |
getEffectiveDataBlockEncoding() |
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.
|
Cell |
getNextIndexedKey() |
HFile.Reader |
getReader() |
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() |
protected void |
readAndUpdateNewBlock(long firstDataBlockOffset) |
protected void |
readKeyValueLen() |
protected void |
readMvccVersion(int offsetFromPos)
Read mvcc.
|
protected HFileBlock |
readNextDataBlock()
Scans blocks in the "scanned" section of the
HFile until the next
data block is found. |
int |
reseekTo(Cell key)
Reseek to or just before the passed
cell. |
boolean |
seekBefore(Cell key)
Consider the cell stream of all the cells in the file,
c[0] .. c[n], where there are n cells in the file. |
boolean |
seekTo()
Positions this scanner at the start of the file.
|
int |
seekTo(Cell key)
SeekTo or just before the passed
cell. |
int |
seekTo(Cell key,
boolean rewind)
An internal API function.
|
protected void |
setNonSeekedState() |
void |
shipped()
Called after a batch of rows scanned and set to be returned to client.
|
String |
toString() |
protected void |
updateCurrentBlock(HFileBlock newBlock)
Updates the current block to be the given
HFileBlock. |
protected final boolean cacheBlocks
protected final boolean pread
protected final boolean isCompaction
protected AtomicInteger blockFetches
protected final HFile.Reader reader
protected Cell nextIndexedKey
protected HFileBlock curBlock
protected final ArrayList<HFileBlock> prevBlocks
public HFileScannerImpl(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction)
public boolean isSeeked()
isSeeked 在接口中 HFileScannerHFileScanner.seekBefore(Cell) or HFileScanner.seekTo() or HFileScanner.seekTo(Cell).
Otherwise returns false.protected void assertSeeked()
public HFile.Reader getReader()
getReader 在接口中 HFileScannerpublic void close()
HFileScannerclose 在接口中 Closeableclose 在接口中 AutoCloseableclose 在接口中 HFileScannerprotected void readKeyValueLen()
protected void readMvccVersion(int offsetFromPos)
offsetFromPos - protected int blockSeek(Cell key, boolean seekBefore)
key - the key to findseekBefore - find the key before the given key in case of exact match.public Cell getNextIndexedKey()
getNextIndexedKey 在接口中 HFileScannerpublic int seekTo(Cell key) throws IOException
HFileScannercell. Examine the return
code to figure whether we found the cell or not.
Consider the cell stream of all the cells in the file,
c[0] .. c[n], where there are n cells in the file.seekTo 在接口中 HFileScannerIOExceptionpublic int reseekTo(Cell key) throws IOException
HFileScannercell. Similar to seekTo
except that this can be called even if the scanner is not at the beginning
of a file.
This can be used to seek only to cells which come after the current position
of the scanner.
Consider the cell stream of all the cells in the file,
c[0] .. c[n], where there are n cellc in the file after
current position of HFileScanner.
The scanner will position itself between c[i] and c[i+1] where
c[i] < cell <= c[i+1].
If there is no cell c[i+1] greater than or equal to the input cell, then the
scanner will position itself at the end of the file and next() will return
false when it is called.reseekTo 在接口中 HFileScannerkey - Cell to find (should be non-null)IOExceptionpublic int seekTo(Cell key, boolean rewind) throws IOException
key - - a cell representing the key that we need to fetchrewind - whether to rewind to the first key of the block before
doing the seek. If this is false, we are assuming we never go
back, otherwise the result is undefined.IOExceptionpublic boolean seekBefore(Cell key) throws IOException
HFileScannerc[0] .. c[n], where there are n cells in the file.seekBefore 在接口中 HFileScannerkey - Cell to findIOExceptionprotected HFileBlock readNextDataBlock() throws IOException
HFile until the next
data block is found.IOExceptionpublic DataBlockEncoding getEffectiveDataBlockEncoding()
public Cell getCell()
getCell 在接口中 HFileScannerCell.public Cell getKey()
HFileScannerHFileScanner.seekTo(Cell) before this method.getKey 在接口中 HFileScannerpublic ByteBuffer getValue()
HFileScannerHFileScanner.seekTo(Cell) before this method.getValue 在接口中 HFileScannerprotected void setNonSeekedState()
public boolean next()
throws IOException
getKey() and getValue() can
be called.next 在接口中 HFileScannerIOExceptionpublic boolean seekTo()
throws IOException
seekTo 在接口中 HFileScannerIOExceptionprotected boolean processFirstDataBlock()
throws IOException
IOExceptionprotected void readAndUpdateNewBlock(long firstDataBlockOffset)
throws IOException,
CorruptHFileException
protected int loadBlockAndSeekToKey(HFileBlock seekToBlock, Cell nextIndexedKey, boolean rewind, Cell key, boolean seekBefore) throws IOException
IOExceptionprotected final boolean checkKeyLen(int v)
v - protected final boolean checkLen(int v)
v - protected final void checkKeyValueLen()
protected void updateCurrentBlock(HFileBlock newBlock) throws IOException
HFileBlock. Seeks to
the the first key/value pair.newBlock - the block to make currentIOExceptionprotected Cell getFirstKeyCellInBlock(HFileBlock curBlock)
public String getKeyString()
HFileScannerHFileScanner.seekTo(Cell) before this method.getKeyString 在接口中 HFileScannerpublic String getValueString()
HFileScannerHFileScanner.seekTo(Cell) before this method.getValueString 在接口中 HFileScannerpublic int compareKey(CellComparator comparator, Cell key)
public void shipped()
throws IOException
Shippershipped 在接口中 ShipperIOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.