Search in sources :

Example 1 with GetContainerWithPipelineBatchRequestProto

use of org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineBatchRequestProto in project ozone by apache.

the class StorageContainerLocationProtocolClientSideTranslatorPB method getContainerWithPipelineBatch.

/**
 * {@inheritDoc}
 */
@Override
public List<ContainerWithPipeline> getContainerWithPipelineBatch(List<Long> containerIDs) throws IOException {
    for (Long containerID : containerIDs) {
        Preconditions.checkState(containerID >= 0, "Container ID cannot be negative");
    }
    GetContainerWithPipelineBatchRequestProto request = GetContainerWithPipelineBatchRequestProto.newBuilder().setTraceID(TracingUtil.exportCurrentSpan()).addAllContainerIDs(containerIDs).build();
    ScmContainerLocationResponse response = submitRequest(Type.GetContainerWithPipelineBatch, (builder) -> builder.setGetContainerWithPipelineBatchRequest(request));
    List<HddsProtos.ContainerWithPipeline> protoCps = response.getGetContainerWithPipelineBatchResponse().getContainerWithPipelinesList();
    List<ContainerWithPipeline> cps = new ArrayList<>();
    for (HddsProtos.ContainerWithPipeline cp : protoCps) {
        cps.add(ContainerWithPipeline.fromProtobuf(cp));
    }
    return cps;
}
Also used : ScmContainerLocationResponse(org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationResponse) GetContainerWithPipelineBatchRequestProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineBatchRequestProto) HddsProtos(org.apache.hadoop.hdds.protocol.proto.HddsProtos) ArrayList(java.util.ArrayList) ContainerWithPipeline(org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline)

Aggregations

ArrayList (java.util.ArrayList)1 HddsProtos (org.apache.hadoop.hdds.protocol.proto.HddsProtos)1 GetContainerWithPipelineBatchRequestProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineBatchRequestProto)1 ScmContainerLocationResponse (org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationResponse)1 ContainerWithPipeline (org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline)1