org.apache.hadoop.hbase.util
Class CollectionBackedScanner

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
      extended by org.apache.hadoop.hbase.util.CollectionBackedScanner
All Implemented Interfaces:
KeyValueScanner

public class CollectionBackedScanner
extends NonLazyKeyValueScanner

Utility scanner that wraps a sortable collection and serves as a KeyValueScanner.


Constructor Summary
CollectionBackedScanner(KeyValue.KVComparator comparator, KeyValue... array)
           
CollectionBackedScanner(List<KeyValue> list)
           
CollectionBackedScanner(List<KeyValue> list, KeyValue.KVComparator comparator)
           
CollectionBackedScanner(SortedSet<KeyValue> set)
           
CollectionBackedScanner(SortedSet<KeyValue> set, KeyValue.KVComparator comparator)
           
 
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 seekKv)
          Reseek the scanner at or after the specified KeyValue.
 boolean seek(KeyValue seekKv)
          Seek the scanner at or after the specified KeyValue.
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
doRealSeek, enforceSeek, isFileScanner, realSeekDone, requestSeek, shouldUseScanner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionBackedScanner

public CollectionBackedScanner(SortedSet<KeyValue> set)

CollectionBackedScanner

public CollectionBackedScanner(SortedSet<KeyValue> set,
                               KeyValue.KVComparator comparator)

CollectionBackedScanner

public CollectionBackedScanner(List<KeyValue> list)

CollectionBackedScanner

public CollectionBackedScanner(List<KeyValue> list,
                               KeyValue.KVComparator comparator)

CollectionBackedScanner

public CollectionBackedScanner(KeyValue.KVComparator comparator,
                               KeyValue... array)
Method Detail

peek

public KeyValue peek()
Description copied from interface: KeyValueScanner
Look at the next KeyValue in this scanner, but do not iterate scanner.

Returns:
the next KeyValue

next

public KeyValue next()
Description copied from interface: KeyValueScanner
Return the next KeyValue in this scanner, iterating the scanner

Returns:
the next KeyValue

seek

public boolean seek(KeyValue seekKv)
Description copied from interface: KeyValueScanner
Seek the scanner at or after the specified KeyValue.

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

reseek

public boolean reseek(KeyValue seekKv)
Description copied from interface: KeyValueScanner
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:
seekKv - seek value (should be non-null)
Returns:
true if scanner has values left, false if end of scanner

getSequenceID

public long getSequenceID()
Description copied from interface: KeyValueScanner
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

public void close()
Description copied from interface: KeyValueScanner
Close the KeyValue scanner.



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