Search in sources :

Example 1 with PrepareBulkLoadRequest

use of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.PrepareBulkLoadRequest in project hbase by apache.

the class SecureBulkLoadEndpointClient method prepareBulkLoad.

public String prepareBulkLoad(final TableName tableName) throws IOException {
    try {
        CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
        SecureBulkLoadProtos.SecureBulkLoadService instance = ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);
        ServerRpcController controller = new ServerRpcController();
        CoprocessorRpcUtils.BlockingRpcCallback<PrepareBulkLoadResponse> rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
        PrepareBulkLoadRequest request = PrepareBulkLoadRequest.newBuilder().setTableName(ProtobufUtil.toProtoTableName(tableName)).build();
        instance.prepareBulkLoad(controller, request, rpcCallback);
        PrepareBulkLoadResponse response = rpcCallback.get();
        if (controller.failedOnException()) {
            throw controller.getFailedOn();
        }
        return response.getBulkToken();
    } catch (Throwable throwable) {
        throw new IOException(throwable);
    }
}
Also used : PrepareBulkLoadRequest(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.PrepareBulkLoadRequest) CoprocessorRpcUtils(org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils) CoprocessorRpcChannel(org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel) IOException(java.io.IOException) PrepareBulkLoadResponse(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.PrepareBulkLoadResponse) ServerRpcController(org.apache.hadoop.hbase.ipc.ServerRpcController) SecureBulkLoadProtos(org.apache.hadoop.hbase.protobuf.generated.SecureBulkLoadProtos)

Aggregations

IOException (java.io.IOException)1 CoprocessorRpcChannel (org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel)1 CoprocessorRpcUtils (org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils)1 ServerRpcController (org.apache.hadoop.hbase.ipc.ServerRpcController)1 PrepareBulkLoadRequest (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.PrepareBulkLoadRequest)1 PrepareBulkLoadResponse (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.PrepareBulkLoadResponse)1 SecureBulkLoadProtos (org.apache.hadoop.hbase.protobuf.generated.SecureBulkLoadProtos)1