use of org.apache.hadoop.hdds.protocol.proto.ScmBlockLocationProtocolProtos.KeyBlocks in project ozone by apache.
the class ScmBlockLocationProtocolClientSideTranslatorPB method deleteKeyBlocks.
/**
* Delete the set of keys specified.
*
* @param keyBlocksInfoList batch of block keys to delete.
* @return list of block deletion results.
* @throws IOException if there is any failure.
*/
@Override
public List<DeleteBlockGroupResult> deleteKeyBlocks(List<BlockGroup> keyBlocksInfoList) throws IOException {
List<KeyBlocks> keyBlocksProto = keyBlocksInfoList.stream().map(BlockGroup::getProto).collect(Collectors.toList());
DeleteScmKeyBlocksRequestProto request = DeleteScmKeyBlocksRequestProto.newBuilder().addAllKeyBlocks(keyBlocksProto).build();
SCMBlockLocationRequest wrapper = createSCMBlockRequest(Type.DeleteScmKeyBlocks).setDeleteScmKeyBlocksRequest(request).build();
final SCMBlockLocationResponse wrappedResponse = handleError(submitRequest(wrapper));
final DeleteScmKeyBlocksResponseProto resp = wrappedResponse.getDeleteScmKeyBlocksResponse();
List<DeleteBlockGroupResult> results = new ArrayList<>(resp.getResultsCount());
results.addAll(resp.getResultsList().stream().map(result -> new DeleteBlockGroupResult(result.getObjectKey(), DeleteBlockGroupResult.convertBlockResultProto(result.getBlockResultsList()))).collect(Collectors.toList()));
return results;
}
Aggregations