001 /**002 * Licensed to the Apache Software Foundation (ASF) under one003 * or more contributor license agreements. See the NOTICE file004 * distributed with this work for additional information005 * regarding copyright ownership. The ASF licenses this file006 * to you under the Apache License, Version 2.0 (the007 * "License"); you may not use this file except in compliance008 * with the License. You may obtain a copy of the License at009 *010 * http://www.apache.org/licenses/LICENSE-2.0011 *012 * Unless required by applicable law or agreed to in writing, software013 * 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 and016 * limitations under the License.017 */018019 package org.apache.hadoop.mapreduce;020021 import java.io.IOException;022 import java.util.Iterator;023024 import org.apache.hadoop.classification.InterfaceAudience;025 import org.apache.hadoop.classification.InterfaceStability;026027 /**028 * The context passed to the {@link Reducer}.029 * @param <KEYIN> the class of the input keys030 * @param <VALUEIN> the class of the input values031 * @param <KEYOUT> the class of the output keys032 * @param <VALUEOUT> the class of the output values033 */034 @InterfaceAudience.Public035 @InterfaceStability.Evolving036 public interface ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>037 extends TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT> {038039 /** Start processing next unique key. */040 public boolean nextKey() throws IOException,InterruptedException;041042 /**043 * Iterate through the values for the current key, reusing the same value 044 * object, which is stored in the context.045 * @return the series of values associated with the current key. All of the 046 * objects returned directly and indirectly from this method are reused.047 */048 public Iterable<VALUEIN> getValues() throws IOException, InterruptedException;049050 /**051 * {@link Iterator} to iterate over values for a given group of records.052 */053 interface ValueIterator<VALUEIN> extends MarkableIteratorInterface<VALUEIN> {054055 /**056 * This method is called when the reducer moves from one key to 057 * another.058 * @throws IOException059 */060 void resetBackupStore() throws IOException;061 }062 }