use of org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.NodeQueryRequestProto in project ozone by apache.
the class StorageContainerLocationProtocolClientSideTranslatorPB method queryNode.
/**
* Queries a list of Nodes based on their operational state or health state.
* Passing a null for either value acts as a wildcard for that state.
*
* @param opState The operation state of the node
* @param nodeState The health of the node
* @param clientVersion
* @return List of Datanodes.
*/
@Override
public List<HddsProtos.Node> queryNode(HddsProtos.NodeOperationalState opState, HddsProtos.NodeState nodeState, HddsProtos.QueryScope queryScope, String poolName, int clientVersion) throws IOException {
// TODO : We support only cluster wide query right now. So ignoring checking
// queryScope and poolName
NodeQueryRequestProto.Builder builder = NodeQueryRequestProto.newBuilder().setTraceID(TracingUtil.exportCurrentSpan()).setScope(queryScope).setPoolName(poolName);
if (opState != null) {
builder.setOpState(opState);
}
if (nodeState != null) {
builder.setState(nodeState);
}
NodeQueryRequestProto request = builder.build();
NodeQueryResponseProto response = submitRequest(Type.QueryNode, builder1 -> builder1.setNodeQueryRequest(request)).getNodeQueryResponse();
return response.getDatanodesList();
}
Aggregations