org.apache.hadoop.hbase.io
Class BatchOperation

java.lang.Object
  extended by org.apache.hadoop.hbase.io.BatchOperation
All Implemented Interfaces:
HeapSize, org.apache.hadoop.io.Writable

public class BatchOperation
extends Object
implements org.apache.hadoop.io.Writable, HeapSize

Batch update operation. If value is null, its a DELETE operation. If its non-null, its a PUT. This object is purposely bare-bones because many instances are created during bulk uploads. We have one class for DELETEs and PUTs rather than a class per type because it makes the serialization easier.

See Also:
BatchUpdate

Field Summary
 int ESTIMATED_HEAP_TAX
          Estimated size of this object.
 
Constructor Summary
BatchOperation()
          Default constructor
BatchOperation(byte[] column)
          Creates a DELETE batch operation.
BatchOperation(byte[] column, byte[] value)
          Create a batch operation.
BatchOperation(String column)
          Creates a DELETE batch operation.
BatchOperation(String column, String value)
          Create a batch operation.
 
Method Summary
 byte[] getColumn()
           
 byte[] getValue()
           
 long heapSize()
           
 boolean isPut()
           
 void readFields(DataInput in)
           
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ESTIMATED_HEAP_TAX

public final int ESTIMATED_HEAP_TAX
Estimated size of this object.

See Also:
Constant Field Values
Constructor Detail

BatchOperation

public BatchOperation()
Default constructor


BatchOperation

public BatchOperation(byte[] column)
Creates a DELETE batch operation.

Parameters:
column - column name

BatchOperation

public BatchOperation(String column)
Creates a DELETE batch operation.

Parameters:
column - column name

BatchOperation

public BatchOperation(String column,
                      String value)
Create a batch operation.

Parameters:
column - column name
value - column value. If non-null, this is a PUT operation.

BatchOperation

public BatchOperation(byte[] column,
                      byte[] value)
Create a batch operation.

Parameters:
column - column name
value - column value. If non-null, this is a PUT operation.
Method Detail

getColumn

public byte[] getColumn()
Returns:
the column

getValue

public byte[] getValue()
Returns:
the value

isPut

public boolean isPut()
Returns:
True if this is a PUT operation (this.value is not null).

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

heapSize

public long heapSize()
Specified by:
heapSize in interface HeapSize
Returns:
Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.


Copyright © 2008 The Apache Software Foundation