org.apache.hbase.codec.prefixtree.scanner
Interface CellScanner

All Known Subinterfaces:
CellSearcher, ReversibleCellScanner
All Known Implementing Classes:
PrefixTreeArrayReversibleScanner, PrefixTreeArrayScanner, PrefixTreeArraySearcher

@InterfaceAudience.Private
public interface CellScanner

Alternate name may be CellInputStream

An interface for iterating through a sequence of cells. Similar to Java's Iterator, but without the hasNext() or remove() methods. The hasNext() method is problematic because it may require actually loading the next object, which in turn requires storing the previous object somewhere. The core data block decoder should be as fast as possible, so we push the complexity and performance expense of concurrently tracking multiple cells to layers above the CellScanner.

The getCurrentCell() method will return a reference to a Cell implementation. This reference may or may not point to a reusable cell implementation, so users of the CellScanner should not, for example, accumulate a List of Cells. All of the references may point to the same object, which would be the latest state of the underlying Cell. In short, the Cell is mutable.

At a minimum, an implementation will need to be able to advance from one cell to the next in a LinkedList fashion. The nextQualifier(), nextFamily(), and nextRow() methods can all be implemented by calling nextCell(), however, if the DataBlockEncoding supports random access into the block then it may provide smarter versions of these methods.

Typical usage:

 while (scanner.nextCell()) {
   Cell cell = scanner.getCurrentCell();
   // do something
 }
 


Method Summary
 org.apache.hbase.Cell getCurrent()
           
 boolean next()
          Advance the scanner 1 cell.
 void resetToBeforeFirstEntry()
          Reset any state in the scanner so it appears it was freshly opened.
 

Method Detail

resetToBeforeFirstEntry

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


getCurrent

org.apache.hbase.Cell getCurrent()
Returns:
the current Cell which may be mutable

next

boolean next()
Advance the scanner 1 cell.

Returns:
true if the next cell is found and getCurrentCell() will return a valid Cell


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