org.apache.hadoop.hbase.io
Class BatchUpdate

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

public class BatchUpdate
extends Object
implements Writable, Iterable<Map.Entry<Text,ArrayList<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()
          constructor
 
Method Summary
 void delete(long lockid, Text column)
          Delete the value for a column
 Iterator<Map.Entry<Text,ArrayList<BatchOperation>>> iterator()
           
 void put(long lockid, Text column, byte[] val)
          Change a value for the specified column
 void readFields(DataInput in)
          Reads the fields of this object from in.
 long startUpdate(Text row)
          Start a batch row insertion/update.
 void write(DataOutput out)
          Writes the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchUpdate

public BatchUpdate()
constructor

Method Detail

startUpdate

public long startUpdate(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 so that the row can be identified.

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

put

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

Parameters:
lockid - - lock id returned from startUpdate
column - - column whose value is being set
val - - new value for column

delete

public void delete(long lockid,
                   Text column)
Delete the value for a column

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

iterator

public Iterator<Map.Entry<Text,ArrayList<BatchOperation>>> iterator()
Specified by:
iterator in interface Iterable<Map.Entry<Text,ArrayList<BatchOperation>>>
Returns:
Iterator>> Text row -> ArrayList changes

readFields

public void readFields(DataInput in)
                throws IOException
Reads the fields of this object from in. For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Writes the fields of this object to out.

Specified by:
write in interface Writable
Throws:
IOException


Copyright © 2006 The Apache Software Foundation