org.apache.hadoop.hbase.regionserver
Class BeforeThisStoreKey

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

public class BeforeThisStoreKey
extends HStoreKey

Pass this class into MapFile.getClosest when searching for the key that comes BEFORE this one but NOT this one. THis class will return > 0 when asked to compare against itself rather than 0. This is a hack for case where getClosest returns a deleted key and we want to get the previous. Can't unless use use this class; it'll just keep returning us the deleted key (getClosest gets exact or nearest before when you pass true argument). TODO: Throw this class away when MapFile has a real 'previous' method. See HBASE-751.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.HStoreKey
HStoreKey.HStoreKeyWritableComparator
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.HStoreKey
COLUMN_FAMILY_DELIMITER
 
Constructor Summary
BeforeThisStoreKey(HStoreKey beforeThisKey)
           
 
Method Summary
 int compareTo(Object o)
          
 boolean equals(Object obj)
          
 byte[] getColumn()
           
 HRegionInfo getHRegionInfo()
           
 byte[] getRow()
           
 long getSize()
           
 long getTimestamp()
           
 int hashCode()
          
 boolean matchesRowCol(HStoreKey other)
          Compares the row and column of two keys
 boolean matchesRowFamily(HStoreKey that)
          Compares the row and column family of two keys
 boolean matchesWithoutColumn(HStoreKey other)
          Compares the row and timestamp of two keys
 void readFields(DataInput in)
          
 void set(HStoreKey k)
          Set the value of this HStoreKey from the supplied key
 void setColumn(byte[] c)
          Change the value of the column in this key
 void setHRegionInfo(HRegionInfo hri)
           
 void setRow(byte[] newrow)
          Change the value of the row key
 void setVersion(long timestamp)
          Change the value of the timestamp field
 String toString()
          
 void write(DataOutput out)
          
 
Methods inherited from class org.apache.hadoop.hbase.HStoreKey
addDelimiter, compareTwoRowKeys, equalsTwoRowKeys, getBytes, getFamily, getFamilyDelimiterIndex, getFamilyMapKey, getQualifier, matchingFamily, parseColumn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeforeThisStoreKey

public BeforeThisStoreKey(HStoreKey beforeThisKey)
Parameters:
beforeThisKey -
Method Detail

compareTo

public int compareTo(Object o)
Description copied from class: HStoreKey

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class HStoreKey

equals

public boolean equals(Object obj)
Description copied from class: HStoreKey

Overrides:
equals in class HStoreKey

getColumn

public byte[] getColumn()
Overrides:
getColumn in class HStoreKey
Returns:
value of column

getRow

public byte[] getRow()
Overrides:
getRow in class HStoreKey
Returns:
value of row key

getSize

public long getSize()
Overrides:
getSize in class HStoreKey
Returns:
Approximate size in bytes of this key.

getTimestamp

public long getTimestamp()
Overrides:
getTimestamp in class HStoreKey
Returns:
value of timestamp

hashCode

public int hashCode()
Description copied from class: HStoreKey

Overrides:
hashCode in class HStoreKey

matchesRowCol

public boolean matchesRowCol(HStoreKey other)
Description copied from class: HStoreKey
Compares the row and column of two keys

Overrides:
matchesRowCol in class HStoreKey
Parameters:
other - Key to compare against. Compares row and column.
Returns:
True if same row and column.
See Also:
HStoreKey.matchesWithoutColumn(HStoreKey), HStoreKey.matchesRowFamily(HStoreKey)

matchesRowFamily

public boolean matchesRowFamily(HStoreKey that)
Description copied from class: HStoreKey
Compares the row and column family of two keys

Overrides:
matchesRowFamily in class HStoreKey
Parameters:
that - Key to compare against. Compares row and column family
Returns:
true if same row and column family
See Also:
HStoreKey.matchesRowCol(HStoreKey), HStoreKey.matchesWithoutColumn(HStoreKey)

matchesWithoutColumn

public boolean matchesWithoutColumn(HStoreKey other)
Description copied from class: HStoreKey
Compares the row and timestamp of two keys

Overrides:
matchesWithoutColumn in class HStoreKey
Parameters:
other - Key to copmare against. Compares row and timestamp.
Returns:
True if same row and timestamp is greater than other
See Also:
HStoreKey.matchesRowCol(HStoreKey), HStoreKey.matchesRowFamily(HStoreKey)

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from class: HStoreKey

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

set

public void set(HStoreKey k)
Description copied from class: HStoreKey
Set the value of this HStoreKey from the supplied key

Overrides:
set in class HStoreKey
Parameters:
k - key value to copy

setColumn

public void setColumn(byte[] c)
Description copied from class: HStoreKey
Change the value of the column in this key

Overrides:
setColumn in class HStoreKey
Parameters:
c - new column family value

setRow

public void setRow(byte[] newrow)
Description copied from class: HStoreKey
Change the value of the row key

Overrides:
setRow in class HStoreKey
Parameters:
newrow - new row key value

setVersion

public void setVersion(long timestamp)
Description copied from class: HStoreKey
Change the value of the timestamp field

Overrides:
setVersion in class HStoreKey
Parameters:
timestamp - new timestamp value

toString

public String toString()
Description copied from class: HStoreKey

Overrides:
toString in class HStoreKey

write

public void write(DataOutput out)
           throws IOException
Description copied from class: HStoreKey

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

getHRegionInfo

public HRegionInfo getHRegionInfo()
Overrides:
getHRegionInfo in class HStoreKey
Returns:
value of regioninfo

setHRegionInfo

public void setHRegionInfo(HRegionInfo hri)
Overrides:
setHRegionInfo in class HStoreKey


Copyright © 2008 The Apache Software Foundation