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.network.group.api.driver;
020
021import org.apache.reef.io.network.group.api.config.OperatorSpec;
022import org.apache.reef.io.network.group.impl.GroupCommunicationMessage;
023import org.apache.reef.tang.Configuration;
024
025/**
026 * A topology should implement the following
027 * interface so that it can work with the
028 * elastic group communication framework
029 * Currently we have two implementations
030 * 1. Flat 2. Tree
031 */
032public interface Topology {
033
034  /**
035   * Get the version of the Task 'taskId'.
036   * that belongs to this topology
037   *
038   * @param taskId
039   * @return
040   */
041  int getNodeVersion(String taskId);
042
043  /**
044   * Get the id of the root task.
045   *
046   * @return
047   */
048  String getRootId();
049
050  /**
051   * Check whether the root node has been added or not.
052   *
053   * @return {@code true} if root has been added, {@code false} otherwise
054   */
055  boolean isRootPresent();
056
057  /**
058   * Set task with id 'senderId' as.
059   * the root of this topology
060   *
061   * @param senderId
062   */
063  void setRootTask(String senderId);
064
065  /**
066   * Add task with id 'taskId' to.
067   * the topology
068   *
069   * @param taskId
070   */
071  void addTask(String taskId);
072
073  /**
074   * Remove task with id 'taskId' from.
075   * the topology
076   *
077   * @param taskId
078   */
079  void removeTask(String taskId);
080
081  /**
082   * Update state on receipt of RunningTask.
083   * event for task with id 'id'
084   *
085   * @param id
086   */
087  void onRunningTask(String id);
088
089  /**
090   * Update state on receipt of FailedTask.
091   * event for task with id 'id'
092   *
093   * @param id
094   */
095  void onFailedTask(String id);
096
097  /**
098   * Set operator specification of the operator.
099   * that is the owner of this topology instance
100   *
101   * @param spec
102   */
103  void setOperatorSpecification(OperatorSpec spec);
104
105  /**
106   * Get the topology portion of the Configuration.
107   * for the task 'taskId' that belongs to this
108   * topology
109   *
110   * @param taskId
111   * @return
112   */
113  Configuration getTaskConfiguration(String taskId);
114
115  /**
116   * Update state on receipt of a message.
117   * from the tasks
118   *
119   * @param msg
120   */
121  void onReceiptOfMessage(GroupCommunicationMessage msg);
122}