1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.apache.hadoop.yarn.api.records;
20 
21 import java.util.List;
22 
23 import org.apache.hadoop.classification.InterfaceAudience.Public;
24 import org.apache.hadoop.classification.InterfaceStability.Unstable;
25 import org.apache.hadoop.yarn.util.Records;
26 
27 /**
28  * {@link ReservationRequests} captures the set of resource and constraints the
29  * user cares about regarding a reservation.
30  *
31  * @see ReservationRequest
32  *
33  */
34 @Public
35 @Unstable
36 public abstract class ReservationRequests {
37 
38   @Public
39   @Unstable
newInstance( List<ReservationRequest> reservationResources, ReservationRequestInterpreter type)40   public static ReservationRequests newInstance(
41       List<ReservationRequest> reservationResources,
42       ReservationRequestInterpreter type) {
43     ReservationRequests reservationRequests =
44         Records.newRecord(ReservationRequests.class);
45     reservationRequests.setReservationResources(reservationResources);
46     reservationRequests.setInterpreter(type);
47     return reservationRequests;
48   }
49 
50   /**
51    * Get the list of {@link ReservationRequest} representing the resources
52    * required by the application
53    *
54    * @return the list of {@link ReservationRequest}
55    */
56   @Public
57   @Unstable
getReservationResources()58   public abstract List<ReservationRequest> getReservationResources();
59 
60   /**
61    * Set the list of {@link ReservationRequest} representing the resources
62    * required by the application
63    *
64    * @param reservationResources the list of {@link ReservationRequest}
65    */
66   @Public
67   @Unstable
setReservationResources( List<ReservationRequest> reservationResources)68   public abstract void setReservationResources(
69       List<ReservationRequest> reservationResources);
70 
71   /**
72    * Get the {@link ReservationRequestInterpreter}, representing how the list of
73    * resources should be allocated, this captures temporal ordering and other
74    * constraints.
75    *
76    * @return the list of {@link ReservationRequestInterpreter}
77    */
78   @Public
79   @Unstable
getInterpreter()80   public abstract ReservationRequestInterpreter getInterpreter();
81 
82   /**
83    * Set the {@link ReservationRequestInterpreter}, representing how the list of
84    * resources should be allocated, this captures temporal ordering and other
85    * constraints.
86    *
87    * @param interpreter the {@link ReservationRequestInterpreter} for this
88    *          reservation
89    */
90   @Public
91   @Unstable
setInterpreter(ReservationRequestInterpreter interpreter)92   public abstract void setInterpreter(ReservationRequestInterpreter interpreter);
93 
94 }
95