org.apache.hadoop.hbase.io.hfile
Class HFileReaderV2.AbstractScannerV2
java.lang.Object
org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
org.apache.hadoop.hbase.io.hfile.HFileReaderV2.AbstractScannerV2
- All Implemented Interfaces:
- HFileScanner
- Direct Known Subclasses:
- HFileReaderV2.EncodedScannerV2, HFileReaderV2.ScannerV2
- Enclosing class:
- HFileReaderV2
protected abstract static class HFileReaderV2.AbstractScannerV2
- extends AbstractHFileReader.Scanner
Field Summary |
protected HFileBlock |
block
|
protected byte[] |
nextIndexedKey
The next indexed key is to keep track of the indexed key of the next data block. |
Method Summary |
protected abstract ByteBuffer |
getFirstKeyInBlock(HFileBlock curBlock)
|
protected abstract int |
loadBlockAndSeekToKey(HFileBlock seekToBlock,
byte[] nextIndexedKey,
boolean rewind,
byte[] key,
int offset,
int length,
boolean seekBefore)
|
protected HFileBlock |
readNextDataBlock()
Scans blocks in the "scanned" section of the HFile until the next
data block is found. |
int |
reseekTo(byte[] key,
int offset,
int length)
|
boolean |
seekBefore(byte[] key,
int offset,
int length)
|
int |
seekTo(byte[] key,
int offset,
int length)
|
protected int |
seekTo(byte[] key,
int offset,
int length,
boolean rewind)
An internal API function. |
block
protected HFileBlock block
nextIndexedKey
protected byte[] nextIndexedKey
- The next indexed key is to keep track of the indexed key of the next data block.
If the nextIndexedKey is HConstants.NO_NEXT_INDEXED_KEY, it means that the
current data block is the last data block.
If the nextIndexedKey is null, it means the nextIndexedKey has not been loaded yet.
HFileReaderV2.AbstractScannerV2
public HFileReaderV2.AbstractScannerV2(HFileReaderV2 r,
boolean cacheBlocks,
boolean pread,
boolean isCompaction)
seekTo
protected int seekTo(byte[] key,
int offset,
int length,
boolean rewind)
throws IOException
- An internal API function. Seek to the given key, optionally rewinding to
the first key of the block before doing the seek.
- Parameters:
key
- key byte arrayoffset
- key offset in the key byte arraylength
- key lengthrewind
- 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.
- Returns:
- -1 if the key is earlier than the first key of the file,
0 if we are at the given key, 1 if we are past the given key
-2 if the key is earlier than the first key of the file while
using a faked index key
- Throws:
IOException
getFirstKeyInBlock
protected abstract ByteBuffer getFirstKeyInBlock(HFileBlock curBlock)
loadBlockAndSeekToKey
protected abstract int loadBlockAndSeekToKey(HFileBlock seekToBlock,
byte[] nextIndexedKey,
boolean rewind,
byte[] key,
int offset,
int length,
boolean seekBefore)
throws IOException
- Throws:
IOException
seekTo
public int seekTo(byte[] key,
int offset,
int length)
throws IOException
- Throws:
IOException
reseekTo
public int reseekTo(byte[] key,
int offset,
int length)
throws IOException
- Throws:
IOException
seekBefore
public boolean seekBefore(byte[] key,
int offset,
int length)
throws IOException
- Throws:
IOException
readNextDataBlock
protected HFileBlock readNextDataBlock()
throws IOException
- Scans blocks in the "scanned" section of the
HFile
until the next
data block is found.
- Returns:
- the next block, or null if there are no more data blocks
- Throws:
IOException
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.