org.apache.hadoop.hbase
Class HRegionInfo

java.lang.Object
  extended by org.apache.hadoop.hbase.HRegionInfo
All Implemented Interfaces:
Comparable, Writable, WritableComparable

public class HRegionInfo
extends Object
implements WritableComparable

HRegion information. Contains HRegion id, start and end keys, a reference to this HRegions' table descriptor, etc.


Field Summary
static char DELIMITER
          delimiter used between portions of a region name
 
Constructor Summary
HRegionInfo()
          Default constructor - creates empty object
HRegionInfo(byte[] serializedBytes)
          Construct a HRegionInfo object from byte array
HRegionInfo(long regionId, HTableDescriptor tableDesc, Text startKey, Text endKey)
          Construct HRegionInfo with explicit parameters
 
Method Summary
 int compareTo(Object o)
          
 boolean equals(Object o)
          
 Text getEndKey()
           
 long getRegionId()
           
 Text getRegionName()
           
 Text getStartKey()
           
 HTableDescriptor getTableDesc()
           
static Text getTableNameFromRegionName(Text regionName)
          Extracts table name prefix from a region name.
 int hashCode()
          
 void readFields(DataInput in)
          Reads the fields of this object from in.
 String toString()
          
 void write(DataOutput out)
          Writes the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIMITER

public static final char DELIMITER
delimiter used between portions of a region name

See Also:
Constant Field Values
Constructor Detail

HRegionInfo

public HRegionInfo()
Default constructor - creates empty object


HRegionInfo

public HRegionInfo(byte[] serializedBytes)
            throws IOException
Construct a HRegionInfo object from byte array

Parameters:
serializedBytes -
Throws:
IOException

HRegionInfo

public HRegionInfo(long regionId,
                   HTableDescriptor tableDesc,
                   Text startKey,
                   Text endKey)
            throws IllegalArgumentException
Construct HRegionInfo with explicit parameters

Parameters:
regionId - the region id
tableDesc - the table descriptor
startKey - first key in region
endKey - end of key range
Throws:
IllegalArgumentException
Method Detail

getTableNameFromRegionName

public static Text getTableNameFromRegionName(Text regionName)
Extracts table name prefix from a region name. Presumes region names are ASCII characters only.

Parameters:
regionName - A region name.
Returns:
The table prefix of a region name.

getEndKey

public Text getEndKey()
Returns:
the endKey

getRegionId

public long getRegionId()
Returns:
the regionId

getRegionName

public Text getRegionName()
Returns:
the regionName

getStartKey

public Text getStartKey()
Returns:
the startKey

getTableDesc

public HTableDescriptor getTableDesc()
Returns:
the tableDesc

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

write

public void write(DataOutput out)
           throws IOException
Writes the fields of this object to out.

Specified by:
write in interface Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Reads the fields of this object from in. For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Throws:
IOException

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable


Copyright © 2006 The Apache Software Foundation