org.apache.hadoop.hbase.util
Interface RegionSplitter.SplitAlgorithm

All Known Implementing Classes:
RegionSplitter.MD5StringSplit
Enclosing class:
RegionSplitter

public static interface RegionSplitter.SplitAlgorithm

A generic interface for the RegionSplitter code to use for all it's functionality. Note that the original authors of this code use RegionSplitter.MD5StringSplit to partition their table and set it as default, but provided this for your custom algorithm. To use, create a new derived class from this interface and call the RegionSplitter class with the argument:
-D split.algorithm=


Method Summary
 byte[] firstRow()
          In HBase, the first row is represented by an empty byte array.
 byte[] lastRow()
          In HBase, the last row is represented by an empty byte array.
 String rowToStr(byte[] row)
           
 String separator()
           
 byte[] split(byte[] start, byte[] end)
          Split a pre-existing region into 2 regions.
 byte[][] split(int numberOfSplits)
          Split an entire table.
 byte[] strToRow(String input)
           
 

Method Detail

split

byte[] split(byte[] start,
             byte[] end)
Split a pre-existing region into 2 regions.

Parameters:
start - row
end - row
Returns:
the split row to use

split

byte[][] split(int numberOfSplits)
Split an entire table.

Parameters:
numberOfSplits - number of regions to split the table into
Returns:
array of split keys for the initial regions of the table

firstRow

byte[] firstRow()
In HBase, the first row is represented by an empty byte array. This might cause problems with your split algorithm or row printing. All your APIs will be passed firstRow() instead of empty array.

Returns:
your representation of your first row

lastRow

byte[] lastRow()
In HBase, the last row is represented by an empty byte array. This might cause problems with your split algorithm or row printing. All your APIs will be passed firstRow() instead of empty array.

Returns:
your representation of your last row

strToRow

byte[] strToRow(String input)
Parameters:
input - user or file input for row
Returns:
byte array representation of this row for HBase

rowToStr

String rowToStr(byte[] row)
Parameters:
row - byte array representing a row in HBase
Returns:
String to use for debug & file printing

separator

String separator()
Returns:
the separator character to use when storing / printing the row


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