org.apache.hadoop.hbase.coprocessor
Class BaseRowProcessorEndpoint<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>

java.lang.Object
  extended by org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.RowProcessorService
      extended by org.apache.hadoop.hbase.coprocessor.BaseRowProcessorEndpoint<S,T>
All Implemented Interfaces:
com.google.protobuf.Service, Coprocessor, CoprocessorService

@InterfaceAudience.LimitedPrivate(value="Coprocesssor")
@InterfaceStability.Evolving
public abstract class BaseRowProcessorEndpoint<S extends com.google.protobuf.Message,T extends com.google.protobuf.Message>
extends RowProcessorProtos.RowProcessorService
implements CoprocessorService, Coprocessor

This class demonstrates how to implement atomic read-modify-writes using HRegion.processRowsWithLocks(org.apache.hadoop.hbase.regionserver.RowProcessor, long, long) and Coprocessor endpoints.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.RowProcessorService
RowProcessorProtos.RowProcessorService.BlockingInterface, RowProcessorProtos.RowProcessorService.Interface, RowProcessorProtos.RowProcessorService.Stub
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.Coprocessor
Coprocessor.State
 
Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.Coprocessor
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
 
Constructor Summary
BaseRowProcessorEndpoint()
           
 
Method Summary
 com.google.protobuf.Service getService()
           
 void process(com.google.protobuf.RpcController controller, RowProcessorProtos.ProcessRequest request, com.google.protobuf.RpcCallback<RowProcessorProtos.ProcessResponse> done)
          Pass a processor to HRegion to process multiple rows atomically.
 void start(CoprocessorEnvironment env)
          Stores a reference to the coprocessor environment provided by the RegionCoprocessorHost from the region where this coprocessor is loaded.
 void stop(CoprocessorEnvironment env)
           
 
Methods inherited from class org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.RowProcessorService
callMethod, getDescriptor, getDescriptorForType, getRequestPrototype, getResponsePrototype, newBlockingStub, newReflectiveBlockingService, newReflectiveService, newStub
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseRowProcessorEndpoint

public BaseRowProcessorEndpoint()
Method Detail

process

public void process(com.google.protobuf.RpcController controller,
                    RowProcessorProtos.ProcessRequest request,
                    com.google.protobuf.RpcCallback<RowProcessorProtos.ProcessResponse> done)
Pass a processor to HRegion to process multiple rows atomically. The RowProcessor implementations should be the inner classes of your RowProcessorEndpoint. This way the RowProcessor can be class-loaded with the Coprocessor endpoint together. See TestRowProcessorEndpoint for example. The request contains information for constructing processor (see constructRowProcessorFromRequest(org.apache.hadoop.hbase.protobuf.generated.RowProcessorProtos.ProcessRequest). The processor object defines the read-modify-write procedure.

Specified by:
process in class RowProcessorProtos.RowProcessorService

getService

public com.google.protobuf.Service getService()
Specified by:
getService in interface CoprocessorService

start

public void start(CoprocessorEnvironment env)
           throws IOException
Stores a reference to the coprocessor environment provided by the RegionCoprocessorHost from the region where this coprocessor is loaded. Since this is a coprocessor endpoint, it always expects to be loaded on a table region, so always expects this to be an instance of RegionCoprocessorEnvironment.

Specified by:
start in interface Coprocessor
Parameters:
env - the environment provided by the coprocessor host
Throws:
IOException - if the provided environment is not an instance of RegionCoprocessorEnvironment

stop

public void stop(CoprocessorEnvironment env)
          throws IOException
Specified by:
stop in interface Coprocessor
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.