hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/StorageContainerManager.java
public List<DatanodeDetails> queryNode(EnumSet<NodeState> nodeStatuses) {
    Preconditions.checkNotNull(nodeStatuses, "Node Query set cannot be null");
    Preconditions.checkState(nodeStatuses.size() > 0, "No valid arguments " +
        "in the query set");
    List<DatanodeDetails> resultList = new LinkedList<>();
    Set<DatanodeDetails> currentSet = new TreeSet<>();

    for (NodeState nodeState : nodeStatuses) {
      Set<DatanodeDetails> nextSet = queryNodeState(nodeState);
      if ((nextSet == null) || (nextSet.size() == 0)) {
        // Right now we only support AND operation. So intersect with
        // any empty set is null.
        return resultList;
      }
      // First time we have to add all the elements, next time we have to
      // do an intersection operation on the set.
      if (currentSet.size() == 0) {
        currentSet.addAll(nextSet);
      } else {
        currentSet.retainAll(nextSet);
      }
    }

    resultList.addAll(currentSet);
    return resultList;
  }
/**
   * Queries a list of Node that match a set of statuses.
   * <p>
   * For example, if the nodeStatuses is HEALTHY and RAFT_MEMBER,
   * then this call will return all healthy nodes which members in
   * Raft pipeline.
   * <p>
   * Right now we don't support operations, so we assume it is an AND operation
   * between the operators.
   *
   * @param nodeStatuses - A set of NodeStates.
   * @return List of Datanodes.
   */
Queries a list of Node that match a set of statuses.

For example, if the nodeStatuses is HEALTHY and RAFT_MEMBER,
then this call will return all healthy nodes which members in
Raft pipeline.

Right now we don't support operations, so we assume it is an AND operation
between the operators.

@param nodeStatuses - A set of NodeStates.
@return List of Datanodes.
Queries a list of Node that match a set of statuses . For example if the nodeStatuses is HEALTHY and RAFT_MEMBER then this call will return all healthy nodes which members in Raft pipeline . Right now we don ' t support operations so we assume it is an AND operation between the operators . @param nodeStatuses - A set of NodeStates . @return List of Datanodes .
public List<DatanodeDetails> queryNode(EnumSet<NodeState> nodeStatuses) {
    Preconditions.checkNotNull(nodeStatuses, "Node Query set cannot be null");
    Preconditions.checkState(nodeStatuses.size() > 0, "No valid arguments " +
        "in the query set");
    List<DatanodeDetails> resultList = new LinkedList<>();
    Set<DatanodeDetails> currentSet = new TreeSet<>();
    for (NodeState nodeState : nodeStatuses) {
      Set<DatanodeDetails> nextSet = queryNodeState(nodeState);
      if ((nextSet == null) || (nextSet.size() == 0)) {
        return resultList;
      }
      if (currentSet.size() == 0) {
        currentSet.addAll(nextSet);
      } else {
        currentSet.retainAll(nextSet);
      }
    }
    resultList.addAll(currentSet);
    return resultList;
  }
public List < DatanodeDetails > queryNode ( EnumSet < NodeState > nodeStatuses ) { Preconditions . checkNotNull ( nodeStatuses , "Node Query set cannot be null" ) ; Preconditions . checkState ( nodeStatuses . size ( ) > 0 , "No valid arguments " + "in the query set" ) ; List < DatanodeDetails > resultList = new LinkedList < > ( ) ; Set < DatanodeDetails > currentSet = new TreeSet < > ( ) ; for ( NodeState nodeState : nodeStatuses ) { Set < DatanodeDetails > nextSet = queryNodeState ( nodeState ) ; if ( ( nextSet == null ) || ( nextSet . size ( ) == 0 ) ) { return resultList ; } if ( currentSet . size ( ) == 0 ) { currentSet . addAll ( nextSet ) ; } else { currentSet . retainAll ( nextSet ) ; } } resultList . addAll ( currentSet ) ; return resultList ; }
Queries a list of Node that match a set of statuses.
Queries a list of Node that match a set of statuses .
// Right now we only support AND operation. So intersect with // any empty set is null. // First time we have to add all the elements, next time we have to // do an intersection operation on the set.