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    
019    package org.apache.hadoop.yarn.api.protocolrecords;
020    
021    import org.apache.hadoop.classification.InterfaceAudience.Public;
022    import org.apache.hadoop.classification.InterfaceStability.Unstable;
023    import org.apache.hadoop.yarn.api.records.ReservationDefinition;
024    import org.apache.hadoop.yarn.api.records.ReservationId;
025    import org.apache.hadoop.yarn.util.Records;
026    
027    /**
028     * {@link ReservationUpdateRequest} captures the set of requirements the user
029     * has to update an existing reservation.
030     * 
031     * @see ReservationDefinition
032     * 
033     */
034    @Public
035    @Unstable
036    public abstract class ReservationUpdateRequest {
037    
038      @Public
039      @Unstable
040      public static ReservationUpdateRequest newInstance(
041          ReservationDefinition reservationDefinition, ReservationId reservationId) {
042        ReservationUpdateRequest request =
043            Records.newRecord(ReservationUpdateRequest.class);
044        request.setReservationDefinition(reservationDefinition);
045        request.setReservationId(reservationId);
046        return request;
047      }
048    
049      /**
050       * Get the {@link ReservationDefinition} representing the updated user
051       * constraints for this reservation
052       * 
053       * @return the reservation definition representing user constraints
054       */
055      @Public
056      @Unstable
057      public abstract ReservationDefinition getReservationDefinition();
058    
059      /**
060       * Set the {@link ReservationDefinition} representing the updated user
061       * constraints for this reservation
062       * 
063       * @param reservationDefinition the reservation request representing the
064       *          reservation
065       */
066      @Public
067      @Unstable
068      public abstract void setReservationDefinition(
069          ReservationDefinition reservationDefinition);
070    
071      /**
072       * Get the {@link ReservationId}, that corresponds to a valid resource
073       * allocation in the scheduler (between start and end time of this
074       * reservation)
075       * 
076       * @return the {@link ReservationId} representing the unique id of the
077       *         corresponding reserved resource allocation in the scheduler
078       */
079      @Public
080      @Unstable
081      public abstract ReservationId getReservationId();
082    
083      /**
084       * Set the {@link ReservationId}, that correspond to a valid resource
085       * allocation in the scheduler (between start and end time of this
086       * reservation)
087       * 
088       * @param reservationId the {@link ReservationId} representing the the unique
089       *          id of the corresponding reserved resource allocation in the
090       *          scheduler
091       */
092      @Public
093      @Unstable
094      public abstract void setReservationId(ReservationId reservationId);
095    
096    }