Search in sources :

Example 6 with LocatedBlockProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto in project hadoop by apache.

the class PBHelperClient method convertLocatedBlocks.

public static List<LocatedBlock> convertLocatedBlocks(List<LocatedBlockProto> lb) {
    if (lb == null)
        return null;
    final int len = lb.size();
    List<LocatedBlock> result = new ArrayList<>(len);
    for (LocatedBlockProto aLb : lb) {
        result.add(convertLocatedBlockProto(aLb));
    }
    return result;
}
Also used : LocatedBlockProto(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto) ArrayList(java.util.ArrayList) LocatedBlock(org.apache.hadoop.hdfs.protocol.LocatedBlock)

Example 7 with LocatedBlockProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto in project hadoop by apache.

the class PBHelperClient method convertLocatedBlocks2.

public static List<LocatedBlockProto> convertLocatedBlocks2(List<LocatedBlock> lb) {
    if (lb == null)
        return null;
    final int len = lb.size();
    List<LocatedBlockProto> result = new ArrayList<>(len);
    for (LocatedBlock aLb : lb) {
        result.add(convertLocatedBlock(aLb));
    }
    return result;
}
Also used : LocatedBlockProto(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto) ArrayList(java.util.ArrayList) LocatedBlock(org.apache.hadoop.hdfs.protocol.LocatedBlock)

Example 8 with LocatedBlockProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method reportBadBlocks.

@Override
public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller, ReportBadBlocksRequestProto req) throws ServiceException {
    try {
        List<LocatedBlockProto> bl = req.getBlocksList();
        server.reportBadBlocks(PBHelperClient.convertLocatedBlocks(bl.toArray(new LocatedBlockProto[bl.size()])));
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    return VOID_REP_BAD_BLOCK_RESPONSE;
}
Also used : ServiceException(com.google.protobuf.ServiceException) LocatedBlockProto(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto) IOException(java.io.IOException)

Aggregations

LocatedBlockProto (org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto)8 LocatedBlock (org.apache.hadoop.hdfs.protocol.LocatedBlock)6 ArrayList (java.util.ArrayList)3 ServiceException (com.google.protobuf.ServiceException)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 RecoveringBlockProto (org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.RecoveringBlockProto)1 RecoveringStripedBlock (org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand.RecoveringStripedBlock)1