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 by Writable.
BatchUpdate(long lockid)
          Client side constructor.
 
Method Summary
 void delete(long lid, org.apache.hadoop.io.Text column)
          Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.
 long getLockid()
           
 org.apache.hadoop.io.Text getRow()
           
 Iterator<BatchOperation> iterator()
           
 void put(long lid, org.apache.hadoop.io.Text column, byte[] val)
          Change a value for the specified column
 void readFields(DataInput in)
           
 long startUpdate(org.apache.hadoop.io.Text row)
          Start a batch row insertion/update.
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchUpdate

public BatchUpdate()
Default constructor - used by Writable.


BatchUpdate

public BatchUpdate(long lockid)
Client side constructor. Clients need to provide the lockid by some means such as Random.nextLong()

Parameters:
lockid -
Method Detail

getLockid

public long getLockid()
Returns:
the lock id

getRow

public org.apache.hadoop.io.Text getRow()
Returns:
the row

startUpdate

public long startUpdate(org.apache.hadoop.io.Text row)
Start a batch row insertion/update. No changes are committed until the client commits the batch operation via HClient.batchCommit(). The entire batch update can be abandoned by calling HClient.batchAbort(); Callers to this method are given a handle that corresponds to the row being changed. The handle must be supplied on subsequent put or delete calls.

Parameters:
row - Name of row to start update against.
Returns:
Row lockid.

put

public void put(long lid,
                org.apache.hadoop.io.Text column,
                byte[] val)
Change a value for the specified column

Parameters:
lid - lock id returned from startUpdate
column - column whose value is being set
val - new value for column. Cannot be null (can be empty).

delete

public void delete(long lid,
                   org.apache.hadoop.io.Text column)
Delete the value for a column Deletes the cell whose row/column/commit-timestamp match those of the delete.

Parameters:
lid - lock id returned from startUpdate
column - name of column whose value is to be deleted

iterator

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

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