public class SegmentScanner extends java.lang.Object implements KeyValueScanner
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closed |
protected Cell |
current |
protected java.util.Iterator<Cell> |
iter |
protected Segment |
segment |
NO_NEXT_INDEXED_KEY| Modifier | Constructor and Description |
|---|---|
protected |
SegmentScanner(Segment segment,
long readPoint) |
protected |
SegmentScanner(Segment segment,
long readPoint,
long scannerOrder) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
backwardSeek(Cell key)
Seek the scanner at or before the row of specified Cell, it firstly
tries to seek the scanner at or after the specified Cell, return if
peek KeyValue of scanner has the same row with specified Cell,
otherwise seek the scanner at the first Cell of the row which is the
previous row of specified KeyValue
|
void |
close()
Close the KeyValue scanner.
|
void |
enforceSeek()
This function should be never called on scanners that always do real seek operations (i.e.
|
Path |
getFilePath() |
protected java.util.Iterator<Cell> |
getIterator(Cell cell) |
Cell |
getNextIndexedKey() |
long |
getScannerOrder()
Get the order of this KeyValueScanner.
|
boolean |
isFileScanner() |
Cell |
next()
Return the next Cell in this scanner, iterating the scanner
|
Cell |
peek()
Look at the next Cell in this scanner, but do not iterate the scanner
|
boolean |
realSeekDone()
This scanner is working solely on the in-memory MemStore and doesn't work on
store files, MutableCellSetSegmentScanner always does the seek,
therefore always returning true.
|
boolean |
requestSeek(Cell c,
boolean forward,
boolean useBloom)
Similar to
KeyValueScanner.seek(Cell) (or KeyValueScanner.reseek(Cell) 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. |
boolean |
reseek(Cell cell)
Reseek the scanner at or after the specified KeyValue.
|
boolean |
seek(Cell cell)
Seek the scanner at or after the specified Cell.
|
boolean |
seekToLastRow()
Seek the scanner at the first KeyValue of last row
|
boolean |
seekToPreviousRow(Cell cell)
Seek the scanner at the first Cell of the row which is the previous row
of specified key
|
void |
shipped()
Called after a batch of rows scanned (RPC) and set to be returned to client.
|
boolean |
shouldUseScanner(Scan scan,
HStore store,
long oldestUnexpiredTS)
This functionality should be resolved in the higher level which is
MemStoreScanner, currently returns true as default.
|
java.lang.String |
toString() |
protected void |
updateCurrent()
Private internal method for iterating over the segment,
skipping the cells with irrelevant MVCC
|
protected final Segment segment
protected java.util.Iterator<Cell> iter
protected Cell current
protected boolean closed
protected SegmentScanner(Segment segment, long readPoint)
protected SegmentScanner(Segment segment, long readPoint, long scannerOrder)
scannerOrder - see KeyValueScanner.getScannerOrder().
Scanners are ordered from 0 (oldest) to newest in increasing order.public Cell peek()
peek in interface KeyValueScannerpublic Cell next()
throws java.io.IOException
next in interface KeyValueScannerjava.io.IOExceptionpublic boolean seek(Cell cell)
throws java.io.IOException
seek in interface KeyValueScannercell - seek valuejava.io.IOExceptionprotected java.util.Iterator<Cell> getIterator(Cell cell)
public boolean reseek(Cell cell)
throws java.io.IOException
reseek in interface KeyValueScannercell - seek value (should be non-null)java.io.IOExceptionpublic boolean backwardSeek(Cell key)
throws java.io.IOException
backwardSeek in interface KeyValueScannerkey - seek Celljava.io.IOExceptionpublic boolean seekToPreviousRow(Cell cell)
throws java.io.IOException
seekToPreviousRow in interface KeyValueScannercell - seek valuejava.io.IOExceptionpublic boolean seekToLastRow()
throws java.io.IOException
seekToLastRow in interface KeyValueScannerjava.io.IOExceptionpublic long getScannerOrder()
KeyValueScannergetScannerOrder in interface KeyValueScannerKeyValueScanner.getScannerOrder()public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface KeyValueScannerpublic boolean shouldUseScanner(Scan scan,
HStore store,
long oldestUnexpiredTS)
shouldUseScanner in interface KeyValueScannerscan - the scan that we are selecting scanners forstore - the store we are performing the scan on.oldestUnexpiredTS - the oldest timestamp we are interested in for
this query, based on TTLpublic boolean requestSeek(Cell c,
boolean forward,
boolean useBloom)
throws java.io.IOException
KeyValueScannerKeyValueScanner.seek(Cell) (or KeyValueScanner.reseek(Cell) 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 by checking row-column Bloom filters
before a seek on multi-column get/scan queries, and to optimize by looking
up more recent files first.requestSeek in interface KeyValueScannerforward - do a forward-only "reseek" instead of a random-access seekuseBloom - whether to enable multi-column Bloom filter optimizationjava.io.IOExceptionpublic boolean realSeekDone()
realSeekDone in interface KeyValueScannerpublic void enforceSeek()
throws java.io.IOException
realSeekDone() first.enforceSeek in interface KeyValueScannerjava.io.IOExceptionpublic boolean isFileScanner()
isFileScanner in interface KeyValueScannerpublic Path getFilePath()
getFilePath in interface KeyValueScannerKeyValueScanner.isFileScanner()public Cell getNextIndexedKey()
getNextIndexedKey in interface KeyValueScannerpublic void shipped()
throws java.io.IOException
public java.lang.String toString()
toString in class java.lang.Objectprotected void updateCurrent()