hadoop UpwardProtocol 源码

  • 2022-10-20
  • 浏览 (139)

haddop UpwardProtocol 代码

文件路径:/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/UpwardProtocol.java

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.hadoop.mapred.pipes;

import java.io.IOException;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;

/**
 * The interface for the messages that can come up from the child. All of these
 * calls are asynchronous and return before the message has been processed.
 */
interface UpwardProtocol<K extends WritableComparable, V extends Writable> {
  /**
   * Output a record from the child.
   * @param key the record's key
   * @param value the record's value
   * @throws IOException
   */
  void output(K key, V value) throws IOException;
  
  /**
   * Map functions where the application has defined a partition function
   * output records along with their partition.
   * @param reduce the reduce to send this record to
   * @param key the record's key
   * @param value the record's value
   * @throws IOException
   */
  void partitionedOutput(int reduce, K key, 
                         V value) throws IOException;
  
  /**
   * Update the task's status message
   * @param msg the string to display to the user
   * @throws IOException
   */
  void status(String msg) throws IOException;
  
  /**
   * Report making progress (and the current progress)
   * @param progress the current progress (0.0 to 1.0)
   * @throws IOException
   */
  void progress(float progress) throws IOException;
  
  /**
   * Report that the application has finished processing all inputs 
   * successfully.
   * @throws IOException
   */
  void done() throws IOException;
  
  /**
   * Report that the application or more likely communication failed.
   * @param e
   */
  void failed(Throwable e);
  
  /**
   * Register a counter with the given id and group/name.
   * @param group counter group
   * @param name counter name
   * @throws IOException
   */
  void registerCounter(int id, String group, String name) throws IOException;
  
  /**
   * Increment the value of a registered counter.
   * @param id counter id of the registered counter
   * @param amount increment for the counter value
   * @throws IOException
   */
  void incrementCounter(int id, long amount) throws IOException;

  /**
   * Handles authentication response from client.
   * It must notify the threads waiting for authentication response.
   * @param digest
   * @return true if authentication is successful
   * @throws IOException
   */
  boolean authenticate(String digest) throws IOException;

}

相关信息

hadoop 源码目录

相关文章

hadoop Application 源码

hadoop BinaryProtocol 源码

hadoop DownwardProtocol 源码

hadoop OutputHandler 源码

hadoop PipesMapRunner 源码

hadoop PipesNonJavaInputFormat 源码

hadoop PipesPartitioner 源码

hadoop PipesReducer 源码

hadoop Submitter 源码

0  赞