org.apache.accumulo.core.data
Class KeyExtent

java.lang.Object
  extended by org.apache.accumulo.core.data.KeyExtent
All Implemented Interfaces:
Comparable<KeyExtent>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<KeyExtent>

public class KeyExtent
extends Object
implements org.apache.hadoop.io.WritableComparable<KeyExtent>


Constructor Summary
KeyExtent()
          Default constructor
KeyExtent(KeyExtent extent)
           
KeyExtent(org.apache.hadoop.io.Text flattenedExtent, org.apache.hadoop.io.Text prevEndRow)
           
KeyExtent(org.apache.hadoop.io.Text table, org.apache.hadoop.io.Text endRow, org.apache.hadoop.io.Text prevEndRow)
           
KeyExtent(org.apache.hadoop.io.Text flattenedExtent, Value prevEndRow)
           
KeyExtent(TKeyExtent tke)
           
 
Method Summary
 int compareTo(KeyExtent other)
          Compares extents based on rows
 boolean contains(org.apache.hadoop.io.BinaryComparable row)
           
 boolean contains(ByteSequence bsrow)
           
static org.apache.hadoop.io.Text decodePrevEndRow(Value ibw)
           
static Value encodePrevEndRow(org.apache.hadoop.io.Text per)
           
 boolean equals(Object o)
           
static SortedSet<KeyExtent> findChildren(KeyExtent ke, SortedSet<KeyExtent> tablets)
           
static KeyExtent findContainingExtent(KeyExtent extent, SortedSet<KeyExtent> extents)
           
static Set<KeyExtent> findOverlapping(KeyExtent nke, SortedMap<KeyExtent,? extends Object> extents)
           
static Set<KeyExtent> findOverlapping(KeyExtent nke, SortedSet<KeyExtent> extents)
           
 org.apache.hadoop.io.Text getEndRow()
          Returns this extent's end row
static Collection<KeyExtent> getKeyExtentsForRange(org.apache.hadoop.io.Text startRow, org.apache.hadoop.io.Text endRow, Set<KeyExtent> kes)
          Empty start or end rows tell the method there are no start or end rows, and to use all the keyextents that are before the end row if no start row etc.
 org.apache.hadoop.io.Text getMetadataEntry()
          Returns a String representing this extent's entry in the Metadata table
static org.apache.hadoop.io.Text getMetadataEntry(KeyExtent extent)
           
static org.apache.hadoop.io.Text getMetadataEntry(org.apache.hadoop.io.Text table, org.apache.hadoop.io.Text row)
           
 org.apache.hadoop.io.Text getPrevEndRow()
          Return the previous extent's end row
 Mutation getPrevRowUpdateMutation()
          Returns a String representing the previous extent's entry in the Metadata table
static Mutation getPrevRowUpdateMutation(KeyExtent ke)
           
 org.apache.hadoop.io.Text getTableId()
          Returns the extent's table id
 UUID getUUID()
           
 int hashCode()
           
 boolean isPreviousExtent(KeyExtent prevExtent)
           
 boolean overlaps(KeyExtent other)
           
 void readFields(DataInput in)
          Populates the extents data fields from a DataInput object
 void setEndRow(org.apache.hadoop.io.Text endRow)
          Sets this extent's end row
 void setPrevEndRow(org.apache.hadoop.io.Text prevEndRow)
          Sets the previous extent's end row
 void setTableId(org.apache.hadoop.io.Text tId)
          Sets the extents table id
static byte[] tableOfMetadataRow(org.apache.hadoop.io.Text row)
           
 Range toDataRange()
           
 Range toMetadataRange()
           
 String toString()
           
 TKeyExtent toThrift()
           
 void write(DataOutput out)
          Writes this extent's data fields to a DataOutput object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyExtent

public KeyExtent()
Default constructor


KeyExtent

public KeyExtent(org.apache.hadoop.io.Text table,
                 org.apache.hadoop.io.Text endRow,
                 org.apache.hadoop.io.Text prevEndRow)

KeyExtent

public KeyExtent(KeyExtent extent)

KeyExtent

public KeyExtent(TKeyExtent tke)

KeyExtent

public KeyExtent(org.apache.hadoop.io.Text flattenedExtent,
                 Value prevEndRow)

KeyExtent

public KeyExtent(org.apache.hadoop.io.Text flattenedExtent,
                 org.apache.hadoop.io.Text prevEndRow)
Method Detail

getMetadataEntry

public org.apache.hadoop.io.Text getMetadataEntry()
Returns a String representing this extent's entry in the Metadata table


getMetadataEntry

public static org.apache.hadoop.io.Text getMetadataEntry(org.apache.hadoop.io.Text table,
                                                         org.apache.hadoop.io.Text row)

setTableId

public void setTableId(org.apache.hadoop.io.Text tId)
Sets the extents table id


getTableId

public org.apache.hadoop.io.Text getTableId()
Returns the extent's table id


setEndRow

public void setEndRow(org.apache.hadoop.io.Text endRow)
Sets this extent's end row


getEndRow

public org.apache.hadoop.io.Text getEndRow()
Returns this extent's end row


getPrevEndRow

public org.apache.hadoop.io.Text getPrevEndRow()
Return the previous extent's end row


setPrevEndRow

public void setPrevEndRow(org.apache.hadoop.io.Text prevEndRow)
Sets the previous extent's end row


readFields

public void readFields(DataInput in)
                throws IOException
Populates the extents data fields from a DataInput object

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

write

public void write(DataOutput out)
           throws IOException
Writes this extent's data fields to a DataOutput object

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

getPrevRowUpdateMutation

public Mutation getPrevRowUpdateMutation()
Returns a String representing the previous extent's entry in the Metadata table


getKeyExtentsForRange

public static Collection<KeyExtent> getKeyExtentsForRange(org.apache.hadoop.io.Text startRow,
                                                          org.apache.hadoop.io.Text endRow,
                                                          Set<KeyExtent> kes)
Empty start or end rows tell the method there are no start or end rows, and to use all the keyextents that are before the end row if no start row etc.

Returns:
all the key extents that the rows cover

decodePrevEndRow

public static org.apache.hadoop.io.Text decodePrevEndRow(Value ibw)

encodePrevEndRow

public static Value encodePrevEndRow(org.apache.hadoop.io.Text per)

getPrevRowUpdateMutation

public static Mutation getPrevRowUpdateMutation(KeyExtent ke)

compareTo

public int compareTo(KeyExtent other)
Compares extents based on rows

Specified by:
compareTo in interface Comparable<KeyExtent>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getUUID

public UUID getUUID()

tableOfMetadataRow

public static byte[] tableOfMetadataRow(org.apache.hadoop.io.Text row)

contains

public boolean contains(ByteSequence bsrow)

contains

public boolean contains(org.apache.hadoop.io.BinaryComparable row)

toDataRange

public Range toDataRange()

toMetadataRange

public Range toMetadataRange()

findChildren

public static SortedSet<KeyExtent> findChildren(KeyExtent ke,
                                                SortedSet<KeyExtent> tablets)

findContainingExtent

public static KeyExtent findContainingExtent(KeyExtent extent,
                                             SortedSet<KeyExtent> extents)

findOverlapping

public static Set<KeyExtent> findOverlapping(KeyExtent nke,
                                             SortedSet<KeyExtent> extents)

overlaps

public boolean overlaps(KeyExtent other)

findOverlapping

public static Set<KeyExtent> findOverlapping(KeyExtent nke,
                                             SortedMap<KeyExtent,? extends Object> extents)

getMetadataEntry

public static org.apache.hadoop.io.Text getMetadataEntry(KeyExtent extent)

toThrift

public TKeyExtent toThrift()

isPreviousExtent

public boolean isPreviousExtent(KeyExtent prevExtent)
Parameters:
prevExtent -


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