Class Node

java.lang.Object
  extended by Node
Direct Known Subclasses:
DVNode

public abstract class Node
extends java.lang.Object

Abstract base class of DV and LS node types. Implements common functionality -- most everything but timestep based routing table update.


Field Summary
protected  boolean failed
          Indicator of whether or not this node has failed
protected  java.util.HashMap<Node,java.lang.Integer> lastHeardDelay
          Each neighbor has a time since last heard from
protected  int lastUpdatedSlot
          Time slot in which we last ran
protected  java.util.LinkedHashSet<Node> neighbor
          Each node has a current list of neighbors
protected static MyRandom rand
           
protected  int uid
          Each node has an integer UID.
 
Constructor Summary
Node()
           
 
Method Summary
protected abstract  void failureEvent()
          Invoked when this node fails.
 RoutingTable getRoutingTable()
           
 int getUID()
           
 boolean hasFailed()
           
protected abstract  void neighborFailureEvent(Node neighbor)
          Invoked when a timeout indicates that a neighbor node has failed.
 void oracleComputeRoutingTable()
          Fills in the routing table using an oracle (i.e., reliable/correct) view of network connectivity.
 void oracleFillTable(RoutingTable rt)
          Fills in the routing table using an oracle (i.e., reliable/correct) view of network connectivity.
protected abstract  void processUpdate(UpdatePacket p)
          Called for each update packet in this node's queue when it is selected to run during a time step.
protected abstract  void recoveryEvent()
          Invoked when this node recovers from a failure.
protected  void sendUpdatePacket(Node dest, UpdatePacket p)
          Send an update packet
 boolean setHasFailed(boolean f)
          Allows manipulation of failure/recovery of this node.
 void setupNeighborInformation()
          Called as an initialization step, once the network topology is finalized.
protected abstract  void startUpdate()
          When this node is selected to run during a time step, the "driver" code in Node.java: first calls this routine (startUpdate()) then with high, but not certain, probability calls processUpdate() for each update packet in the node's queue
  • protected abstract  void stopUpdate()
              See startUpdate().
     void swapInQueues()
              Swaps the current and future in queues.
     void takeStep()
              Causes node to read currentInQueue of update packets and act on them.
     java.lang.String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    uid

    protected int uid
    Each node has an integer UID. (They're consecutive.)


    neighbor

    protected java.util.LinkedHashSet<Node> neighbor
    Each node has a current list of neighbors


    lastHeardDelay

    protected java.util.HashMap<Node,java.lang.Integer> lastHeardDelay
    Each neighbor has a time since last heard from


    lastUpdatedSlot

    protected int lastUpdatedSlot
    Time slot in which we last ran


    failed

    protected boolean failed
    Indicator of whether or not this node has failed


    rand

    protected static MyRandom rand
    Constructor Detail

    Node

    public Node()
    Method Detail

    getUID

    public int getUID()

    getRoutingTable

    public RoutingTable getRoutingTable()

    hasFailed

    public boolean hasFailed()

    oracleComputeRoutingTable

    public void oracleComputeRoutingTable()
    Fills in the routing table using an oracle (i.e., reliable/correct) view of network connectivity.


    oracleFillTable

    public void oracleFillTable(RoutingTable rt)
    Fills in the routing table using an oracle (i.e., reliable/correct) view of network connectivity.


    setupNeighborInformation

    public void setupNeighborInformation()
    Called as an initialization step, once the network topology is finalized. Node should do whatever it has to do to understand who it thinks its neighbors are.


    sendUpdatePacket

    protected void sendUpdatePacket(Node dest,
                                    UpdatePacket p)
                             throws java.lang.IllegalArgumentException
    Send an update packet

    Throws:
    java.lang.IllegalArgumentException

    swapInQueues

    public void swapInQueues()
    Swaps the current and future in queues. (Called by Network code each time it is asked to take a step.)


    takeStep

    public void takeStep()
    Causes node to read currentInQueue of update packets and act on them.


    setHasFailed

    public boolean setHasFailed(boolean f)
    Allows manipulation of failure/recovery of this node.


    startUpdate

    protected abstract void startUpdate()
    When this node is selected to run during a time step, the "driver" code in Node.java:
    1. first calls this routine (startUpdate())
    2. then with high, but not certain, probability calls processUpdate() for each update packet in the node's queue
    3. (1) and (3) allow some flexibility in the implementation of different (sub)classes of node, without having to meddle with the code in Node.java.


    processUpdate

    protected abstract void processUpdate(UpdatePacket p)
    Called for each update packet in this node's queue when it is selected to run during a time step.


    stopUpdate

    protected abstract void stopUpdate()
    See startUpdate().


    failureEvent

    protected abstract void failureEvent()
    Invoked when this node fails.


    recoveryEvent

    protected abstract void recoveryEvent()
    Invoked when this node recovers from a failure.


    neighborFailureEvent

    protected abstract void neighborFailureEvent(Node neighbor)
    Invoked when a timeout indicates that a neighbor node has failed.


    toString

    public java.lang.String toString()
    Overrides:
    toString in class java.lang.Object