org.apache.hadoop.hbase.regionserver.wal
Class HLogKey

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.wal.HLogKey
All Implemented Interfaces:
Comparable<HLogKey>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<HLogKey>

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

A Key for an entry in the change log. The log intermingles edits to many tables and rows, so each log entry identifies the appropriate table and row. Within a table and row, they're also sorted.

Some Transactional edits (START, COMMIT, ABORT) will not have an associated row.


Constructor Summary
HLogKey()
          Writable Consructor -- Do not use.
HLogKey(byte[] encodedRegionName, byte[] tablename, long logSeqNum, long now)
          Create the log key! We maintain the tablename mainly for debugging purposes.
 
Method Summary
 int compareTo(HLogKey o)
           
 boolean equals(Object obj)
           
 byte getClusterId()
          Get the id of the original cluster
 byte[] getEncodedRegionName()
           
 long getLogSeqNum()
           
 byte[] getTablename()
           
 long getWriteTime()
           
 int hashCode()
           
 void readFields(DataInput in)
           
 void setClusterId(byte clusterId)
          Set the cluster id of this key
 String toString()
           
 Map<String,Object> toStringMap()
          Produces a string map for this key.
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HLogKey

public HLogKey()
Writable Consructor -- Do not use.


HLogKey

public HLogKey(byte[] encodedRegionName,
               byte[] tablename,
               long logSeqNum,
               long now)
Create the log key! We maintain the tablename mainly for debugging purposes. A regionName is always a sub-table object.

Parameters:
encodedRegionName - Encoded name of the region as returned by HRegionInfo#getEncodedNameAsBytes().
tablename - - name of table
logSeqNum - - log sequence number
now - Time at which this edit was written.
Method Detail

getEncodedRegionName

public byte[] getEncodedRegionName()
Returns:
encoded region name

getTablename

public byte[] getTablename()
Returns:
table name

getLogSeqNum

public long getLogSeqNum()
Returns:
log sequence number

getWriteTime

public long getWriteTime()
Returns:
the write time

getClusterId

public byte getClusterId()
Get the id of the original cluster

Returns:
Cluster id.

setClusterId

public void setClusterId(byte clusterId)
Set the cluster id of this key

Parameters:
clusterId -

toString

public String toString()
Overrides:
toString in class Object

toStringMap

public Map<String,Object> toStringMap()
Produces a string map for this key. Useful for programmatic use and manipulation of the data stored in an HLogKey, for example, printing as JSON.

Returns:
a Map containing data from this key

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(HLogKey o)
Specified by:
compareTo in interface Comparable<HLogKey>

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


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