org.apache.hadoop.hbase.io
Class BatchUpdate

java.lang.Object
  extended by org.apache.hadoop.hbase.io.BatchUpdate
All Implemented Interfaces:
Iterable<BatchOperation>, org.apache.hadoop.io.Writable

public class BatchUpdate
extends Object
implements org.apache.hadoop.io.Writable, Iterable<BatchOperation>

A Writable object that contains a series of BatchOperations There is one BatchUpdate object per server, so a series of batch operations can result in multiple BatchUpdate objects if the batch contains rows that are served by multiple region servers.


Constructor Summary
BatchUpdate()
          Default constructor used serializing.
BatchUpdate(byte[] row)
          Initialize a BatchUpdate operation on a row.
BatchUpdate(byte[] row, long timestamp)
          Initialize a BatchUpdate operation on a row with a specific timestamp.
BatchUpdate(String row)
          Initialize a BatchUpdate operation on a row.
BatchUpdate(String row, long timestamp)
          Initialize a BatchUpdate operation on a row with a specific timestamp.
 
Method Summary
 void delete(byte[] column)
          Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.
 void delete(String column)
          Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.
 byte[] get(byte[] column)
          Get the current value of the specified column
 byte[] get(String column)
          Get the current value of the specified column
 byte[][] getColumns()
          Get the current columns
 byte[] getRow()
           
 long getTimestamp()
           
 boolean hasColumn(byte[] column)
          Check if the specified column is currently assigned a value
 boolean hasColumn(String column)
          Check if the specified column is currently assigned a value
 Iterator<BatchOperation> iterator()
           
 void put(byte[] column, byte[] val)
          Change a value for the specified column
 void put(String column, byte[] val)
          Change a value for the specified column
 void readFields(DataInput in)
           
 void setTimestamp(long timestamp)
          Set this BatchUpdate's timestamp.
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BatchUpdate

public BatchUpdate()
Default constructor used serializing. Do not use directly.


BatchUpdate

public BatchUpdate(String row)
Initialize a BatchUpdate operation on a row. Timestamp is assumed to be now.

Parameters:
row -

BatchUpdate

public BatchUpdate(byte[] row)
Initialize a BatchUpdate operation on a row. Timestamp is assumed to be now.

Parameters:
row -

BatchUpdate

public BatchUpdate(String row,
                   long timestamp)
Initialize a BatchUpdate operation on a row with a specific timestamp.

Parameters:
row -
timestamp -

BatchUpdate

public BatchUpdate(byte[] row,
                   long timestamp)
Initialize a BatchUpdate operation on a row with a specific timestamp.

Parameters:
row -
timestamp -
Method Detail

getRow

public byte[] getRow()
Returns:
the row

getTimestamp

public long getTimestamp()
Returns:
the timestamp this BatchUpdate will be committed with.

setTimestamp

public void setTimestamp(long timestamp)
Set this BatchUpdate's timestamp.

Parameters:
timestamp -

get

public byte[] get(String column)
Get the current value of the specified column

Parameters:
column - column name
Returns:
byte[] the cell value, returns null if the column does not exist.

get

public byte[] get(byte[] column)
Get the current value of the specified column

Parameters:
column - column name
Returns:
byte[] the cell value, returns null if the column does not exist.

getColumns

public byte[][] getColumns()
Get the current columns

Returns:
byte[][] an array of byte[] columns

hasColumn

public boolean hasColumn(String column)
Check if the specified column is currently assigned a value

Parameters:
column - column to check for
Returns:
boolean true if the given column exists

hasColumn

public boolean hasColumn(byte[] column)
Check if the specified column is currently assigned a value

Parameters:
column - column to check for
Returns:
boolean true if the given column exists

put

public void put(String column,
                byte[] val)
Change a value for the specified column

Parameters:
column - column whose value is being set
val - new value for column. Cannot be null (can be empty).

put

public void put(byte[] column,
                byte[] val)
Change a value for the specified column

Parameters:
column - column whose value is being set
val - new value for column. Cannot be null (can be empty).

delete

public void delete(String column)
Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.

Parameters:
column - name of column whose value is to be deleted

delete

public void delete(byte[] column)
Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.

Parameters:
column - name of column whose value is to be deleted

iterator

public Iterator<BatchOperation> iterator()
Specified by:
iterator in interface Iterable<BatchOperation>
Returns:
Iterator

toString

public String toString()
Overrides:
toString in class Object

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException


Copyright © 2008 The Apache Software Foundation