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
Method Summary |
protected abstract ByteBuffer |
getFirstKeyInBlock(HFileBlock curBlock)
|
protected abstract int |
loadBlockAndSeekToKey(HFileBlock seekToBlock,
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
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, and 1 if we are past the given key
- Throws:
IOException
getFirstKeyInBlock
protected abstract ByteBuffer getFirstKeyInBlock(HFileBlock curBlock)
loadBlockAndSeekToKey
protected abstract int loadBlockAndSeekToKey(HFileBlock seekToBlock,
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 © 2012 The Apache Software Foundation. All Rights Reserved.