org.apache.hadoop.hbase.regionserver
Interface RowProcessor<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>

All Known Implementing Classes:
BaseRowProcessor

@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface RowProcessor<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>


Method Summary
 UUID getClusterId()
           
 String getName()
          Human readable name of the processor
 S getRequestData()
          This method should return any additional data that is needed on the server side to construct the RowProcessor.
 T getResult()
          Obtain the processing result.
 Collection<byte[]> getRowsToLock()
          Rows to lock while operation.
 void initialize(S msg)
          This method should initialize any field(s) of the RowProcessor with a parsing of the passed message bytes (used on the server side).
 void postProcess(HRegion region, WALEdit walEdit)
          The hook to be executed after process().
 void preProcess(HRegion region, WALEdit walEdit)
          The hook to be executed before process().
 void process(long now, HRegion region, List<KeyValue> mutations, WALEdit walEdit)
          HRegion handles the locks and MVCC and invokes this method properly.
 boolean readOnly()
          Is this operation read only? If this is true, process() should not add any mutations or it throws IOException.
 

Method Detail

getRowsToLock

Collection<byte[]> getRowsToLock()
Rows to lock while operation. They have to be sorted with RowProcessor to avoid deadlock.


getResult

T getResult()
Obtain the processing result. All row processor implementations must implement this, even if the method is simply returning an empty Message.


readOnly

boolean readOnly()
Is this operation read only? If this is true, process() should not add any mutations or it throws IOException.

Returns:
ture if read only operation

process

void process(long now,
             HRegion region,
             List<KeyValue> mutations,
             WALEdit walEdit)
             throws IOException
HRegion handles the locks and MVCC and invokes this method properly. You should override this to create your own RowProcessor. If you are doing read-modify-write here, you should consider using IsolationLevel.READ_UNCOMMITTED for scan because we advance MVCC after releasing the locks for optimization purpose.

Parameters:
now - the current system millisecond
region - the HRegion
mutations - the output mutations to apply to memstore
walEdit - the output WAL edits to apply to write ahead log
Throws:
IOException

preProcess

void preProcess(HRegion region,
                WALEdit walEdit)
                throws IOException
The hook to be executed before process().

Parameters:
region - the HRegion
walEdit - the output WAL edits to apply to write ahead log
Throws:
IOException

postProcess

void postProcess(HRegion region,
                 WALEdit walEdit)
                 throws IOException
The hook to be executed after process().

Parameters:
region - the HRegion
walEdit - the output WAL edits to apply to write ahead log
Throws:
IOException

getClusterId

UUID getClusterId()
Returns:
The replication cluster id.

getName

String getName()
Human readable name of the processor

Returns:
The name of the processor

getRequestData

S getRequestData()
                                                     throws IOException
This method should return any additional data that is needed on the server side to construct the RowProcessor. The server will pass this to the initialize(Message msg) method. If there is no RowProcessor specific data then null should be returned.

Returns:
the PB message
Throws:
IOException

initialize

void initialize(S msg)
                throws IOException
This method should initialize any field(s) of the RowProcessor with a parsing of the passed message bytes (used on the server side).

Parameters:
msg -
Throws:
IOException


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