org.apache.hadoop.hbase.coprocessor.example
Class RowCountEndpoint

java.lang.Object
  extended by org.apache.hadoop.hbase.coprocessor.example.generated.ExampleProtos.RowCountService
      extended by org.apache.hadoop.hbase.coprocessor.example.RowCountEndpoint
All Implemented Interfaces:
com.google.protobuf.Service, Coprocessor, CoprocessorService

public class RowCountEndpoint
extends ExampleProtos.RowCountService
implements Coprocessor, CoprocessorService

Sample coprocessor endpoint exposing a Service interface for counting rows and key values.

For the protocol buffer definition of the RowCountService, see the source file located under hbase-server/src/main/protobuf/Examples.proto.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.coprocessor.example.generated.ExampleProtos.RowCountService
ExampleProtos.RowCountService.BlockingInterface, ExampleProtos.RowCountService.Interface, ExampleProtos.RowCountService.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
RowCountEndpoint()
           
 
Method Summary
 void getKeyValueCount(com.google.protobuf.RpcController controller, ExampleProtos.CountRequest request, com.google.protobuf.RpcCallback<ExampleProtos.CountResponse> done)
          Returns a count of all KeyValues in the region where this coprocessor is loaded.
 void getRowCount(com.google.protobuf.RpcController controller, ExampleProtos.CountRequest request, com.google.protobuf.RpcCallback<ExampleProtos.CountResponse> done)
          Returns a count of the rows in the region where this coprocessor is loaded.
 com.google.protobuf.Service getService()
          Just returns a reference to this object, which implements the RowCounterService interface.
 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.coprocessor.example.generated.ExampleProtos.RowCountService
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

RowCountEndpoint

public RowCountEndpoint()
Method Detail

getService

public com.google.protobuf.Service getService()
Just returns a reference to this object, which implements the RowCounterService interface.

Specified by:
getService in interface CoprocessorService

getRowCount

public void getRowCount(com.google.protobuf.RpcController controller,
                        ExampleProtos.CountRequest request,
                        com.google.protobuf.RpcCallback<ExampleProtos.CountResponse> done)
Returns a count of the rows in the region where this coprocessor is loaded.

Specified by:
getRowCount in class ExampleProtos.RowCountService

getKeyValueCount

public void getKeyValueCount(com.google.protobuf.RpcController controller,
                             ExampleProtos.CountRequest request,
                             com.google.protobuf.RpcCallback<ExampleProtos.CountResponse> done)
Returns a count of all KeyValues in the region where this coprocessor is loaded.

Specified by:
getKeyValueCount in class ExampleProtos.RowCountService

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 © 2015 The Apache Software Foundation. All rights reserved.