org.apache.hadoop.hbase.util.byterange
Class ByteRangeSet

java.lang.Object
  extended by org.apache.hadoop.hbase.util.byterange.ByteRangeSet
Direct Known Subclasses:
ByteRangeHashSet, ByteRangeTreeSet

@InterfaceAudience.Private
public abstract class ByteRangeSet
extends Object

Performance oriented class for de-duping and storing arbitrary byte[]'s arriving in non-sorted order. Appends individual byte[]'s to a single big byte[] to avoid overhead and garbage.

Current implementations are ByteRangeHashSet and ByteRangeTreeSet, but other options might be a trie-oriented ByteRangeTrieSet, etc


Field Summary
protected  byte[] byteAppender
          fields
protected  int numBytes
           
protected  int numInputs
           
protected  int numUniqueRanges
           
protected  int[] sortedIndexByInsertionId
           
protected  List<Integer> sortedIndexByUniqueIndex
           
protected  ArrayList<ByteRange> sortedRanges
           
protected  Map<ByteRange,Integer> uniqueIndexByUniqueRange
           
protected  int[] uniqueRangeIndexByInsertionId
           
protected  ArrayList<ByteRange> uniqueRanges
           
 
Constructor Summary
protected ByteRangeSet()
          construct
 
Method Summary
 void add(ByteRange bytes)
          Check if the incoming byte range exists.
abstract  void addToSortedRanges()
          abstract
 ByteRangeSet compile()
           
 long getAvgSize()
           
 int getSortedIndexForInsertionId(int insertionId)
           
 ArrayList<ByteRange> getSortedRanges()
          get/set
 void reset()
           
 int size()
           
protected  int store(ByteRange bytes)
           
 String toString()
          standard methods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

byteAppender

protected byte[] byteAppender
fields


numBytes

protected int numBytes

uniqueIndexByUniqueRange

protected Map<ByteRange,Integer> uniqueIndexByUniqueRange

uniqueRanges

protected ArrayList<ByteRange> uniqueRanges

numUniqueRanges

protected int numUniqueRanges

uniqueRangeIndexByInsertionId

protected int[] uniqueRangeIndexByInsertionId

numInputs

protected int numInputs

sortedIndexByUniqueIndex

protected List<Integer> sortedIndexByUniqueIndex

sortedIndexByInsertionId

protected int[] sortedIndexByInsertionId

sortedRanges

protected ArrayList<ByteRange> sortedRanges
Constructor Detail

ByteRangeSet

protected ByteRangeSet()
construct

Method Detail

reset

public void reset()

addToSortedRanges

public abstract void addToSortedRanges()
abstract


add

public void add(ByteRange bytes)
Check if the incoming byte range exists. If not, add it to the backing byteAppender[] and insert it into the tracking Map uniqueIndexByUniqueRange.


store

protected int store(ByteRange bytes)

compile

public ByteRangeSet compile()

getSortedIndexForInsertionId

public int getSortedIndexForInsertionId(int insertionId)

size

public int size()

toString

public String toString()
standard methods

Overrides:
toString in class Object

getSortedRanges

public ArrayList<ByteRange> getSortedRanges()
get/set


getAvgSize

public long getAvgSize()


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