001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.protocolrecords;
020
021import java.util.EnumSet;
022
023import org.apache.hadoop.classification.InterfaceAudience.Public;
024import org.apache.hadoop.classification.InterfaceStability.Stable;
025import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
026import org.apache.hadoop.yarn.api.records.NodeState;
027import org.apache.hadoop.yarn.util.Records;
028
029/**
030 * <p>The request from clients to get a report of all nodes
031 * in the cluster from the <code>ResourceManager</code>.</p>
032 *
033 * The request will ask for all nodes in the given {@link NodeState}s.
034 *
035 * @see ApplicationClientProtocol#getClusterNodes(GetClusterNodesRequest) 
036 */
037@Public
038@Stable
039public abstract class GetClusterNodesRequest {
040  @Public
041  @Stable 
042  public static GetClusterNodesRequest newInstance(EnumSet<NodeState> states) {
043    GetClusterNodesRequest request =
044        Records.newRecord(GetClusterNodesRequest.class);
045    request.setNodeStates(states);
046    return request;
047  }
048  
049  @Public
050  @Stable 
051  public static GetClusterNodesRequest newInstance() {
052    GetClusterNodesRequest request =
053        Records.newRecord(GetClusterNodesRequest.class);
054    return request;
055  }
056  
057  /**
058   * The state to filter the cluster nodes with.
059   */
060  public abstract EnumSet<NodeState> getNodeStates();
061  
062  /**
063   * The state to filter the cluster nodes with.
064   */
065  public abstract void setNodeStates(EnumSet<NodeState> states);
066}