org.apache.hadoop.hbase.regionserver
Interface KeyValueScanner

All Known Implementing Classes:
AbstractKeyValueScanner, CollectionBackedScanner, KeyValueHeap, MemStore.MemStoreScanner

public interface KeyValueScanner

Scanner that returns the next KeyValue.


Method Summary
 void close()
          Close the KeyValue scanner.
 long getSequenceID()
          Get the sequence id associated with this KeyValueScanner.
 KeyValue next()
          Return the next KeyValue in this scanner, iterating the scanner
 KeyValue peek()
          Look at the next KeyValue in this scanner, but do not iterate scanner.
 boolean reseek(KeyValue key)
          Reseek the scanner at or after the specified KeyValue.
 boolean seek(KeyValue key)
          Seek the scanner at or after the specified KeyValue.
 boolean seekExactly(KeyValue kv, boolean forward)
          Similar to seek(org.apache.hadoop.hbase.KeyValue) (or reseek(org.apache.hadoop.hbase.KeyValue) if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter.
 

Method Detail

peek

KeyValue peek()
Look at the next KeyValue in this scanner, but do not iterate scanner.

Returns:
the next KeyValue

next

KeyValue next()
              throws IOException
Return the next KeyValue in this scanner, iterating the scanner

Returns:
the next KeyValue
Throws:
IOException

seek

boolean seek(KeyValue key)
             throws IOException
Seek the scanner at or after the specified KeyValue.

Parameters:
key - seek value
Returns:
true if scanner has values left, false if end of scanner
Throws:
IOException

reseek

boolean reseek(KeyValue key)
               throws IOException
Reseek the scanner at or after the specified KeyValue. This method is guaranteed to seek at or after the required key only if the key comes after the current position of the scanner. Should not be used to seek to a key which may come before the current position.

Parameters:
key - seek value (should be non-null)
Returns:
true if scanner has values left, false if end of scanner
Throws:
IOException

seekExactly

boolean seekExactly(KeyValue kv,
                    boolean forward)
                    throws IOException
Similar to seek(org.apache.hadoop.hbase.KeyValue) (or reseek(org.apache.hadoop.hbase.KeyValue) if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter. This function was added to avoid unnecessary disk seeks on multi-column get queries using Bloom filter checking. Should only be used for queries where the set of columns is specified exactly.

Throws:
IOException

getSequenceID

long getSequenceID()
Get the sequence id associated with this KeyValueScanner. This is required for comparing multiple files to find out which one has the latest data. The default implementation for this would be to return 0. A file having lower sequence id will be considered to be the older one.


close

void close()
Close the KeyValue scanner.



Copyright © 2012 The Apache Software Foundation. All Rights Reserved.