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.impl.GroupCommunicationMessage;
022import org.apache.reef.io.network.proto.ReefNetworkGroupCommProtos.GroupCommMessage.Type;
023
024/**
025 * Tracks the Status of the ctrl msgs sent to a
026 * task node in the topology -
027 *   what msgs have been sent to this node and
028 *   what msgs have been ACKed as received by this node
029 *   Status of neighbors
030 * This is used to see whether the local topology
031 * of a Task is completely set-up
032 * It also offers convenience methods for waiting
033 * on receiving ACKs from the task.
034 */
035public interface TaskNodeStatus {
036
037  boolean hasChanges();
038
039  void onTopologySetupMessageSent();
040
041  boolean isActive(String neighborId);
042
043  /**
044   * Process the msg that was received and update.
045   * state accordingly
046   */
047  void processAcknowledgement(GroupCommunicationMessage msg);
048
049  /**
050   * To be called before sending a ctrl msg to the task
051   * represented by this node. All ctrl msgs sent to this
052   * node need to be ACKed.
053   * Ctrl msgs will be sent        from a src and
054   * ACK sent from the task will be for a src.
055   * As this is called from the TaskNodeImpl use srcId of msg
056   * In TaskNodeImpl while processMsg        use dstId of msg
057   */
058  void expectAckFor(final Type msgType, final String srcId);
059
060  /**
061   * Used when the task has failed to clear all.
062   * the state that is associated with this task
063   * Also should release the locks held for implementing
064   * the convenience wait* methods
065   */
066  void clearStateAndReleaseLocks();
067
068  /**
069   * This should remove state concerning neighboring tasks.
070   * that have failed
071   */
072  void updateFailureOf(String taskId);
073
074  void waitForTopologySetup();
075
076  /**
077   * Called to denote that a UpdateTopology msg will.
078   * be sent
079   */
080  void updatingTopology();
081}