This project has retired. For details please refer to its Attic page.
Source code
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,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.io.data.loading.api;
020
021import org.apache.reef.annotations.audience.DriverSide;
022import org.apache.reef.driver.context.ActiveContext;
023import org.apache.reef.driver.evaluator.AllocatedEvaluator;
024import org.apache.reef.tang.Configuration;
025
026/**
027 * All data loading services should implement this interface.
028 */
029@DriverSide
030public interface DataLoadingService {
031
032  /**
033   * Access to the number of partitions suggested by this DataSource.
034   *
035   * @return the number of partitions suggested by this DataSource.
036   */
037  int getNumberOfPartitions();
038
039  /**
040   * @return the context configuration for the given Evaluator.
041   */
042  Configuration getContextConfiguration(final AllocatedEvaluator allocatedEvaluator);
043
044  /**
045   * @return the service configuration for the given Evaluator.
046   */
047  Configuration getServiceConfiguration(final AllocatedEvaluator allocatedEvaluator);
048
049  /**
050   * @return Return the prefix to be used to enumerate
051   * context ids for compute requests fired other than
052   * the data load contexts.
053   */
054  String getComputeContextIdPrefix();
055
056  /**
057   * Distinguishes data loaded contexts from compute contexts.
058   *
059   * @return true if this context has been loaded with data.
060   */
061  boolean isDataLoadedContext(ActiveContext context);
062
063  /**
064   * @return true if this is a computation context,
065   * false otherwise. (e.g. this is a data loading context).
066   */
067  boolean isComputeContext(ActiveContext context);
068}