|
||||
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 package org.apache.spark.network.shuffle; 0019 0020 import java.io.Closeable; 0021 import java.util.Collections; 0022 0023 import com.codahale.metrics.MetricSet; 0024 0025 /** 0026 * Provides an interface for reading both shuffle files and RDD blocks, either from an Executor 0027 * or external service. 0028 */ 0029 public abstract class BlockStoreClient implements Closeable { 0030 0031 /** 0032 * Fetch a sequence of blocks from a remote node asynchronously, 0033 * 0034 * Note that this API takes a sequence so the implementation can batch requests, and does not 0035 * return a future so the underlying implementation can invoke onBlockFetchSuccess as soon as 0036 * the data of a block is fetched, rather than waiting for all blocks to be fetched. 0037 * 0038 * @param host the host of the remote node. 0039 * @param port the port of the remote node. 0040 * @param execId the executor id. 0041 * @param blockIds block ids to fetch. 0042 * @param listener the listener to receive block fetching status. 0043 * @param downloadFileManager DownloadFileManager to create and clean temp files. 0044 * If it's not <code>null</code>, the remote blocks will be streamed 0045 * into temp shuffle files to reduce the memory usage, otherwise, 0046 * they will be kept in memory. 0047 */ 0048 public abstract void fetchBlocks( 0049 String host, 0050 int port, 0051 String execId, 0052 String[] blockIds, 0053 BlockFetchingListener listener, 0054 DownloadFileManager downloadFileManager); 0055 0056 /** 0057 * Get the shuffle MetricsSet from BlockStoreClient, this will be used in MetricsSystem to 0058 * get the Shuffle related metrics. 0059 */ 0060 public MetricSet shuffleMetrics() { 0061 // Return an empty MetricSet by default. 0062 return () -> Collections.emptyMap(); 0063 } 0064 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |