use of org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto in project ozone by apache.
the class StorageContainerLocationProtocolClientSideTranslatorPB method getExistContainerWithPipelinesInBatch.
/**
* {@inheritDoc}
*/
@Override
public List<ContainerWithPipeline> getExistContainerWithPipelinesInBatch(List<Long> containerIDs) {
for (Long containerID : containerIDs) {
Preconditions.checkState(containerID >= 0, "Container ID cannot be negative");
}
GetExistContainerWithPipelinesInBatchRequestProto request = GetExistContainerWithPipelinesInBatchRequestProto.newBuilder().setTraceID(TracingUtil.exportCurrentSpan()).addAllContainerIDs(containerIDs).build();
ScmContainerLocationResponse response = null;
List<ContainerWithPipeline> cps = new ArrayList<>();
try {
response = submitRequest(Type.GetExistContainerWithPipelinesInBatch, (builder) -> builder.setGetExistContainerWithPipelinesInBatchRequest(request));
} catch (IOException ex) {
return cps;
}
List<HddsProtos.ContainerWithPipeline> protoCps = response.getGetExistContainerWithPipelinesInBatchResponse().getContainerWithPipelinesList();
for (HddsProtos.ContainerWithPipeline cp : protoCps) {
try {
cps.add(ContainerWithPipeline.fromProtobuf(cp));
} catch (IOException uex) {
// "fromProtobuf" may throw an exception
// do nothing , just go ahead
}
}
return cps;
}
Aggregations