org.apache.hadoop.hbase.regionserver
Class MemStore.MemStoreScanner

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
      extended by org.apache.hadoop.hbase.regionserver.MemStore.MemStoreScanner
All Implemented Interfaces:
KeyValueScanner
Enclosing class:
MemStore

protected class MemStore.MemStoreScanner
extends NonLazyKeyValueScanner


Method Summary
 boolean backwardSeek(KeyValue key)
          Seek scanner to the given key first.
 void close()
          Close the KeyValue scanner.
 long getSequenceID()
          MemStoreScanner returns max value as sequence id because it will always have the latest data among all files.
 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)
          Move forward on the sub-lists set previously by seek.
 boolean seek(KeyValue key)
          Set the scanner at the seek key.
 boolean seekToLastRow()
          Seek the scanner at the first KeyValue of last row
 boolean seekToPreviousRow(KeyValue originalKey)
          Separately get the KeyValue before the specified key from kvset and snapshotset, and use the row of higher one as the previous row of specified key, then seek to the first KeyValue of previous row
 boolean shouldUseScanner(Scan scan, SortedSet<byte[]> columns, long oldestUnexpiredTS)
          Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
doRealSeek, enforceSeek, getNextIndexedKey, isFileScanner, realSeekDone, requestSeek
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

seek

public boolean seek(KeyValue key)
Set the scanner at the seek key. Must be called only once: there is no thread safety between the scanner and the memStore.

Parameters:
key - seek value
Returns:
false if the key is null or if there is no data

reseek

public boolean reseek(KeyValue key)
Move forward on the sub-lists set previously by seek.

Parameters:
key - seek value (should be non-null)
Returns:
true if there is at least one KV to read, false otherwise

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

close

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


getSequenceID

public long getSequenceID()
MemStoreScanner returns max value as sequence id because it will always have the latest data among all files.


shouldUseScanner

public boolean shouldUseScanner(Scan scan,
                                SortedSet<byte[]> columns,
                                long oldestUnexpiredTS)
Description copied from interface: KeyValueScanner
Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.

Specified by:
shouldUseScanner in interface KeyValueScanner
Overrides:
shouldUseScanner in class NonLazyKeyValueScanner
Parameters:
scan - the scan that we are selecting scanners for
columns - the set of columns in the current column family, or null if not specified by the scan
oldestUnexpiredTS - the oldest timestamp we are interested in for this query, based on TTL
Returns:
true if the scanner should be included in the query

backwardSeek

public boolean backwardSeek(KeyValue key)
Seek scanner to the given key first. If it returns false(means peek()==null) or scanner's peek row is bigger than row of given key, seek the scanner to the previous row of given key

Parameters:
key - seek KeyValue
Returns:
true if the scanner is at the valid KeyValue, false if such KeyValue does not exist

seekToPreviousRow

public boolean seekToPreviousRow(KeyValue originalKey)
Separately get the KeyValue before the specified key from kvset and snapshotset, and use the row of higher one as the previous row of specified key, then seek to the first KeyValue of previous row

Parameters:
originalKey - seek value
Returns:
true if the scanner at the first valid KeyValue of previous row, false if not existing such KeyValue

seekToLastRow

public boolean seekToLastRow()
Description copied from interface: KeyValueScanner
Seek the scanner at the first KeyValue of last row

Returns:
true if scanner has values left, false if the underlying data is empty


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.