org.apache.hadoop.hbase
Class HRegionInfo

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

public class HRegionInfo
extends Object
implements org.apache.hadoop.io.WritableComparable

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


Field Summary
static HRegionInfo firstMetaRegionInfo
          HRegionInfo for first meta region
static HRegionInfo rootRegionInfo
          HRegionInfo for root region
 
Constructor Summary
HRegionInfo()
          Default constructor - creates empty object
HRegionInfo(HTableDescriptor tableDesc, org.apache.hadoop.io.Text startKey, org.apache.hadoop.io.Text endKey)
          Construct HRegionInfo with explicit parameters
HRegionInfo(HTableDescriptor tableDesc, org.apache.hadoop.io.Text startKey, org.apache.hadoop.io.Text endKey, boolean split)
          Construct HRegionInfo with explicit parameters
 
Method Summary
 int compareTo(Object o)
          
static String encodeRegionName(org.apache.hadoop.io.Text regionName)
           
 boolean equals(Object o)
          
 String getEncodedName()
           
 org.apache.hadoop.io.Text getEndKey()
           
 long getRegionId()
           
 org.apache.hadoop.io.Text getRegionName()
           
 org.apache.hadoop.io.Text getStartKey()
           
 HTableDescriptor getTableDesc()
           
static org.apache.hadoop.io.Text getTableNameFromRegionName(org.apache.hadoop.io.Text regionName)
          Extracts table name prefix from a region name.
 int hashCode()
          
 boolean isMetaRegion()
           
 boolean isMetaTable()
           
 boolean isOffline()
           
 boolean isRootRegion()
           
 boolean isSplit()
           
 void readFields(DataInput in)
          
 void setOffline(boolean offLine)
           
 void setSplit(boolean split)
           
 String toString()
          
 void write(DataOutput out)
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rootRegionInfo

public static final HRegionInfo rootRegionInfo
HRegionInfo for root region


firstMetaRegionInfo

public static final HRegionInfo firstMetaRegionInfo
HRegionInfo for first meta region

Constructor Detail

HRegionInfo

public HRegionInfo()
Default constructor - creates empty object


HRegionInfo

public HRegionInfo(HTableDescriptor tableDesc,
                   org.apache.hadoop.io.Text startKey,
                   org.apache.hadoop.io.Text endKey)
            throws IllegalArgumentException
Construct HRegionInfo with explicit parameters

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

HRegionInfo

public HRegionInfo(HTableDescriptor tableDesc,
                   org.apache.hadoop.io.Text startKey,
                   org.apache.hadoop.io.Text endKey,
                   boolean split)
            throws IllegalArgumentException
Construct HRegionInfo with explicit parameters

Parameters:
tableDesc - the table descriptor
startKey - first key in region
endKey - end of key range
split - true if this region has split and we have daughter regions regions that may or may not hold references to this region.
Throws:
IllegalArgumentException
Method Detail

encodeRegionName

public static String encodeRegionName(org.apache.hadoop.io.Text regionName)
Parameters:
regionName -
Returns:
the encodedName

getTableNameFromRegionName

public static org.apache.hadoop.io.Text getTableNameFromRegionName(org.apache.hadoop.io.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 org.apache.hadoop.io.Text getEndKey()
Returns:
the endKey

getRegionId

public long getRegionId()
Returns:
the regionId

getRegionName

public org.apache.hadoop.io.Text getRegionName()
Returns:
the regionName

getEncodedName

public String getEncodedName()
Returns:
the encoded region name

getStartKey

public org.apache.hadoop.io.Text getStartKey()
Returns:
the startKey

getTableDesc

public HTableDescriptor getTableDesc()
Returns:
the tableDesc

isRootRegion

public boolean isRootRegion()
Returns:
true if this is the root region

isMetaTable

public boolean isMetaTable()
Returns:
true if this is the meta table

isMetaRegion

public boolean isMetaRegion()
Returns:
true if this region is a meta region

isSplit

public boolean isSplit()
Returns:
True if has been split and has daughters.

setSplit

public void setSplit(boolean split)
Parameters:
split - set split status

isOffline

public boolean isOffline()
Returns:
True if this region is offline.

setOffline

public void setOffline(boolean offLine)
Parameters:
offLine - set online - offline status

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

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable


Copyright © 2008 The Apache Software Foundation