org.apache.hadoop.hbase.regionserver
Class StoreScanner

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
      extended by org.apache.hadoop.hbase.regionserver.StoreScanner
All Implemented Interfaces:
Closeable, ChangedReadersObserver, InternalScanner, KeyValueScanner

public class StoreScanner
extends NonLazyKeyValueScanner
implements KeyValueScanner, InternalScanner, ChangedReadersObserver

Scanner scans both the memstore and the HStore. Coalesce KeyValue stream into List for a single row.


Constructor Summary
StoreScanner(Store store, Store.ScanInfo scanInfo, Scan scan, List<? extends KeyValueScanner> scanners, ScanType scanType, long smallestReadPoint, long earliestPutTs)
          Used for major compactions.
StoreScanner(Store store, Store.ScanInfo scanInfo, Scan scan, NavigableSet<byte[]> columns)
          Opens a scanner across memstore, snapshot, and all StoreFiles.
 
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
 boolean next(List<KeyValue> outResult)
          Grab the next row's worth of values.
 boolean next(List<KeyValue> outResult, int limit)
          Get the next row of values from this Store.
 boolean next(List<KeyValue> outResult, int limit, String metric)
          Get the next row of values from this Store.
 boolean next(List<KeyValue> outResult, String metric)
          Grab the next row's worth of values.
 KeyValue peek()
          Look at the next KeyValue in this scanner, but do not iterate scanner.
 boolean reseek(KeyValue kv)
          Reseek the scanner at or after the specified KeyValue.
 boolean seek(KeyValue key)
          Seek the scanner at or after the specified KeyValue.
 void updateReaders()
          Notify observers.
 
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
 
Methods inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
enforceSeek, isFileScanner, realSeekDone, requestSeek, shouldUseScanner
 

Constructor Detail

StoreScanner

public StoreScanner(Store store,
                    Store.ScanInfo scanInfo,
                    Scan scan,
                    NavigableSet<byte[]> columns)
             throws IOException
Opens a scanner across memstore, snapshot, and all StoreFiles. Assumes we are not in a compaction.

Parameters:
store - who we scan
scan - the spec
columns - which columns we are scanning
Throws:
IOException

StoreScanner

public StoreScanner(Store store,
                    Store.ScanInfo scanInfo,
                    Scan scan,
                    List<? extends KeyValueScanner> scanners,
                    ScanType scanType,
                    long smallestReadPoint,
                    long earliestPutTs)
             throws IOException
Used for major compactions.

Opens a scanner across specified StoreFiles.

Parameters:
store - who we scan
scan - the spec
scanners - ancillary scanners
smallestReadPoint - the readPoint that we should use for tracking versions
Throws:
IOException
Method Detail

peek

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

Specified by:
peek in interface KeyValueScanner
Returns:
the next KeyValue

next

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

Specified by:
next in interface KeyValueScanner
Returns:
the next KeyValue

close

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

Specified by:
close in interface Closeable
Specified by:
close in interface InternalScanner
Specified by:
close in interface KeyValueScanner

seek

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

Specified by:
seek in interface KeyValueScanner
Parameters:
key - seek value
Returns:
true if scanner has values left, false if end of scanner
Throws:
IOException

next

public boolean next(List<KeyValue> outResult,
                    int limit)
             throws IOException
Get the next row of values from this Store.

Specified by:
next in interface InternalScanner
Parameters:
outResult -
limit -
Returns:
true if there are more rows, false if scanner is done
Throws:
IOException - e

next

public boolean next(List<KeyValue> outResult,
                    int limit,
                    String metric)
             throws IOException
Get the next row of values from this Store.

Specified by:
next in interface InternalScanner
Parameters:
outResult -
limit -
metric - the metric name
Returns:
true if there are more rows, false if scanner is done
Throws:
IOException - e

next

public boolean next(List<KeyValue> outResult)
             throws IOException
Description copied from interface: InternalScanner
Grab the next row's worth of values.

Specified by:
next in interface InternalScanner
Parameters:
outResult - return output array
Returns:
true if more rows exist after this one, false if scanner is done
Throws:
IOException - e

next

public boolean next(List<KeyValue> outResult,
                    String metric)
             throws IOException
Description copied from interface: InternalScanner
Grab the next row's worth of values.

Specified by:
next in interface InternalScanner
Parameters:
outResult - return output array
metric - the metric name
Returns:
true if more rows exist after this one, false if scanner is done
Throws:
IOException - e

updateReaders

public void updateReaders()
                   throws IOException
Description copied from interface: ChangedReadersObserver
Notify observers.

Specified by:
updateReaders in interface ChangedReadersObserver
Throws:
IOException - e

reseek

public boolean reseek(KeyValue kv)
               throws IOException
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.

Specified by:
reseek in interface KeyValueScanner
Parameters:
kv - seek value (should be non-null)
Returns:
true if scanner has values left, false if end of scanner
Throws:
IOException

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.

Specified by:
getSequenceID in interface KeyValueScanner


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