use of org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto in project hadoop by apache.
the class Sender method replaceBlock.
@Override
public void replaceBlock(final ExtendedBlock blk, final StorageType storageType, final Token<BlockTokenIdentifier> blockToken, final String delHint, final DatanodeInfo source) throws IOException {
OpReplaceBlockProto proto = OpReplaceBlockProto.newBuilder().setHeader(DataTransferProtoUtil.buildBaseHeader(blk, blockToken)).setStorageType(PBHelperClient.convertStorageType(storageType)).setDelHint(delHint).setSource(PBHelperClient.convertDatanodeInfo(source)).build();
send(out, Op.REPLACE_BLOCK, proto);
}
use of org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpReplaceBlockProto in project hadoop by apache.
the class Receiver method opReplaceBlock.
/** Receive OP_REPLACE_BLOCK */
private void opReplaceBlock(DataInputStream in) throws IOException {
OpReplaceBlockProto proto = OpReplaceBlockProto.parseFrom(vintPrefixed(in));
TraceScope traceScope = continueTraceSpan(proto.getHeader(), proto.getClass().getSimpleName());
try {
replaceBlock(PBHelperClient.convert(proto.getHeader().getBlock()), PBHelperClient.convertStorageType(proto.getStorageType()), PBHelperClient.convert(proto.getHeader().getToken()), proto.getDelHint(), PBHelperClient.convert(proto.getSource()));
} finally {
if (traceScope != null)
traceScope.close();
}
}
Aggregations