Search in sources :

Example 1 with CacheReportResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportResponseProto in project hadoop by apache.

the class DatanodeProtocolServerSideTranslatorPB method cacheReport.

@Override
public CacheReportResponseProto cacheReport(RpcController controller, CacheReportRequestProto request) throws ServiceException {
    DatanodeCommand cmd = null;
    try {
        cmd = impl.cacheReport(PBHelper.convert(request.getRegistration()), request.getBlockPoolId(), request.getBlocksList());
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    CacheReportResponseProto.Builder builder = CacheReportResponseProto.newBuilder();
    if (cmd != null) {
        builder.setCmd(PBHelper.convert(cmd));
    }
    return builder.build();
}
Also used : DatanodeCommand(org.apache.hadoop.hdfs.server.protocol.DatanodeCommand) ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException) CacheReportResponseProto(org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportResponseProto)

Example 2 with CacheReportResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportResponseProto in project hadoop by apache.

the class DatanodeProtocolClientSideTranslatorPB method cacheReport.

@Override
public DatanodeCommand cacheReport(DatanodeRegistration registration, String poolId, List<Long> blockIds) throws IOException {
    CacheReportRequestProto.Builder builder = CacheReportRequestProto.newBuilder().setRegistration(PBHelper.convert(registration)).setBlockPoolId(poolId);
    for (Long blockId : blockIds) {
        builder.addBlocks(blockId);
    }
    CacheReportResponseProto resp;
    try {
        resp = rpcProxy.cacheReport(NULL_CONTROLLER, builder.build());
    } catch (ServiceException se) {
        throw ProtobufHelper.getRemoteException(se);
    }
    if (resp.hasCmd()) {
        return PBHelper.convert(resp.getCmd());
    }
    return null;
}
Also used : ServiceException(com.google.protobuf.ServiceException) CacheReportResponseProto(org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportResponseProto) CacheReportRequestProto(org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportRequestProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 CacheReportResponseProto (org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportResponseProto)2 IOException (java.io.IOException)1 CacheReportRequestProto (org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.CacheReportRequestProto)1 DatanodeCommand (org.apache.hadoop.hdfs.server.protocol.DatanodeCommand)1