org.apache.hadoop.hbase.codec.prefixtree.scanner
Interface CellSearcher

All Superinterfaces:
CellScanner, ReversibleCellScanner
All Known Implementing Classes:
PrefixTreeArraySearcher

@InterfaceAudience.Private
public interface CellSearcher
extends ReversibleCellScanner

Methods for seeking to a random Cell inside a sorted collection of cells. Indicates that the implementation is able to navigate between cells without iterating through every cell.


Method Summary
 void positionAfterLastCell()
          Note: This may not be appropriate to have in the interface.
 boolean positionAt(Cell key)
          Do everything within this scanner's power to find the key.
 CellScannerPosition positionAtOrAfter(Cell key)
          Same as positionAt(..), but go to the extra effort of finding the next key if there's no exact match.
 CellScannerPosition positionAtOrBefore(Cell key)
          Same as positionAt(..), but go to the extra effort of finding the previous key if there's no exact match.
 void resetToBeforeFirstEntry()
          Reset any state in the scanner so it appears it was freshly opened.
 boolean seekForwardTo(Cell key)
          Note: Added for backwards compatibility with KeyValueScanner

Look for the key, but only look after the current position.

 CellScannerPosition seekForwardToOrAfter(Cell key)
          Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.
 CellScannerPosition seekForwardToOrBefore(Cell key)
          Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.
 
Methods inherited from interface org.apache.hadoop.hbase.codec.prefixtree.scanner.ReversibleCellScanner
previous, previousRow
 
Methods inherited from interface org.apache.hadoop.hbase.CellScanner
advance, current
 

Method Detail

resetToBeforeFirstEntry

void resetToBeforeFirstEntry()
Reset any state in the scanner so it appears it was freshly opened.


positionAt

boolean positionAt(Cell key)
Do everything within this scanner's power to find the key. Look forward and backwards.

Abort as soon as we know it can't be found, possibly leaving the Searcher in an invalid state.

Parameters:
key - position the CellScanner exactly on this key
Returns:
true if the cell existed and getCurrentCell() holds a valid cell

positionAtOrBefore

CellScannerPosition positionAtOrBefore(Cell key)
Same as positionAt(..), but go to the extra effort of finding the previous key if there's no exact match.

Parameters:
key - position the CellScanner on this key or the closest cell before
Returns:
AT if exact match
BEFORE if on last cell before key
BEFORE_FIRST if key was before the first cell in this scanner's scope

positionAtOrAfter

CellScannerPosition positionAtOrAfter(Cell key)
Same as positionAt(..), but go to the extra effort of finding the next key if there's no exact match.

Parameters:
key - position the CellScanner on this key or the closest cell after
Returns:
AT if exact match
AFTER if on first cell after key
AFTER_LAST if key was after the last cell in this scanner's scope

seekForwardTo

boolean seekForwardTo(Cell key)
Note: Added for backwards compatibility with KeyValueScanner

Look for the key, but only look after the current position. Probably not needed for an efficient tree implementation, but is important for implementations without random access such as unencoded KeyValue blocks.

Parameters:
key - position the CellScanner exactly on this key
Returns:
true if getCurrent() holds a valid cell

seekForwardToOrBefore

CellScannerPosition seekForwardToOrBefore(Cell key)
Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.

Parameters:
key -
Returns:
AT if exact match
AFTER if on first cell after key
AFTER_LAST if key was after the last cell in this scanner's scope

seekForwardToOrAfter

CellScannerPosition seekForwardToOrAfter(Cell key)
Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.

Parameters:
key -
Returns:
AT if exact match
AFTER if on first cell after key
AFTER_LAST if key was after the last cell in this scanner's scope

positionAfterLastCell

void positionAfterLastCell()
Note: This may not be appropriate to have in the interface. Need to investigate.

Position the scanner in an invalid state after the last cell: CellScannerPosition.AFTER_LAST. This is used by tests and for handling certain edge cases.



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