org.apache.hadoop.hbase.io.hfile
Class AbstractHFileReader.Scanner

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.AbstractHFileReader.Scanner
All Implemented Interfaces:
HFileScanner
Direct Known Subclasses:
HFileReaderV2.AbstractScannerV2
Enclosing class:
AbstractHFileReader

protected abstract static class AbstractHFileReader.Scanner
extends Object
implements HFileScanner


Field Summary
protected  ByteBuffer blockBuffer
           
protected  int blockFetches
           
protected  boolean cacheBlocks
           
protected  int currKeyLen
           
protected  long currMemstoreTS
           
protected  int currMemstoreTSLen
           
protected  int currValueLen
           
protected  boolean isCompaction
           
protected  boolean pread
           
protected  HFile.Reader reader
           
 
Constructor Summary
AbstractHFileReader.Scanner(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction)
           
 
Method Summary
protected  void assertSeeked()
           
 HFile.Reader getReader()
           
 boolean isSeeked()
           
 int reseekTo(byte[] key)
          Reseek to or just before the passed key.
 boolean seekBefore(byte[] key)
          Consider the key stream of all the keys in the file, k[0] ..
 int seekTo(byte[] key)
          SeekTo or just before the passed key.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.io.hfile.HFileScanner
getKey, getKeyString, getKeyValue, getNextIndexedKey, getValue, getValueString, next, reseekTo, seekBefore, seekTo, seekTo
 

Field Detail

blockBuffer

protected ByteBuffer blockBuffer

cacheBlocks

protected boolean cacheBlocks

pread

protected final boolean pread

isCompaction

protected final boolean isCompaction

currKeyLen

protected int currKeyLen

currValueLen

protected int currValueLen

currMemstoreTSLen

protected int currMemstoreTSLen

currMemstoreTS

protected long currMemstoreTS

blockFetches

protected int blockFetches

reader

protected final HFile.Reader reader
Constructor Detail

AbstractHFileReader.Scanner

public AbstractHFileReader.Scanner(HFile.Reader reader,
                                   boolean cacheBlocks,
                                   boolean pread,
                                   boolean isCompaction)
Method Detail

isSeeked

public boolean isSeeked()
Specified by:
isSeeked in interface HFileScanner
Returns:
True is scanner has had one of the seek calls invoked; i.e. HFileScanner.seekBefore(byte[]) or HFileScanner.seekTo() or HFileScanner.seekTo(byte[]). Otherwise returns false.

toString

public String toString()
Overrides:
toString in class Object

assertSeeked

protected void assertSeeked()

seekTo

public int seekTo(byte[] key)
           throws IOException
Description copied from interface: HFileScanner
SeekTo or just before the passed key. Examine the return code to figure whether we found the key or not. Consider the key stream of all the keys in the file, k[0] .. k[n], where there are n keys in the file.

Specified by:
seekTo in interface HFileScanner
Parameters:
key - Key to find.
Returns:
-1, if key < k[0], no position; 0, such that k[i] = key and scanner is left in position i; and 1, such that k[i] < key, and scanner is left in position i. The scanner will position itself between k[i] and k[i+1] where k[i] < key <= k[i+1]. If there is no key k[i+1] greater than or equal to the input key, then the scanner will position itself at the end of the file and next() will return false when it is called.
Throws:
IOException

seekBefore

public boolean seekBefore(byte[] key)
                   throws IOException
Description copied from interface: HFileScanner
Consider the key stream of all the keys in the file, k[0] .. k[n], where there are n keys in the file.

Specified by:
seekBefore in interface HFileScanner
Parameters:
key - Key to find
Returns:
false if key <= k[0] or true with scanner in position 'i' such that: k[i] < key. Furthermore: there may be a k[i+1], such that k[i] < key <= k[i+1] but there may also NOT be a k[i+1], and next() will return false (EOF).
Throws:
IOException

reseekTo

public int reseekTo(byte[] key)
             throws IOException
Description copied from interface: HFileScanner
Reseek to or just before the passed key. 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 keys which come after the current position of the scanner. Consider the key stream of all the keys in the file, k[0] .. k[n], where there are n keys in the file after current position of HFileScanner. The scanner will position itself between k[i] and k[i+1] where k[i] < key <= k[i+1]. If there is no key k[i+1] greater than or equal to the input key, then the scanner will position itself at the end of the file and next() will return false when it is called.

Specified by:
reseekTo in interface HFileScanner
Parameters:
key - Key to find (should be non-null)
Returns:
-1, if key < k[0], no position; 0, such that k[i] = key and scanner is left in position i; and 1, such that k[i] < key, and scanner is left in position i.
Throws:
IOException

getReader

public HFile.Reader getReader()
Specified by:
getReader in interface HFileScanner
Returns:
Reader that underlies this Scanner instance.


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.