Rice Pastry API

rice.pastry.direct
Interface NetworkSimulator

All Known Implementing Classes:
BasicNetworkSimulator

public interface NetworkSimulator

Interface to an object which is simulating the network.

Version:
$Id: NetworkSimulator.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Andrew Ladd

Method Summary
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node)
          Deliver message ASAP.
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay)
          Deliver message.
 ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay, int period)
          Deliver message.
 ScheduledMessage deliverMessageFixedRate(Message msg, DirectPastryNode node, int delay, int period)
          Deliver message.
 void destroy(DirectPastryNode dpn)
          DESCRIBE THE METHOD
 CancellableTask enqueueDelivery(Delivery del)
          Deliver message.
 NodeRecord generateNodeRecord()
          Generates a random node record
 DirectNodeHandle getClosest(DirectNodeHandle nh)
          Returns the closest Node in proximity.
 Environment getEnvironment()
          Gets the Environment attribute of the NetworkSimulator object
 TestRecord getTestRecord()
          Gets the TestRecord attribute of the NetworkSimulator object
 boolean isAlive(DirectNodeHandle nh)
          Checks to see if a node id is alive.
 int proximity(DirectNodeHandle a, DirectNodeHandle b)
          Determines proximity between two nodes.
 void registerNode(DirectPastryNode dpn)
          Registers a node handle with the simulator.
 void removeNode(DirectPastryNode node)
          DESCRIBE THE METHOD
 void setTestRecord(TestRecord tr)
          Sets the TestRecord attribute of the NetworkSimulator object
 void start()
          DESCRIBE THE METHOD
 void stop()
          DESCRIBE THE METHOD
 

Method Detail

getEnvironment

public Environment getEnvironment()
Gets the Environment attribute of the NetworkSimulator object

Returns:
The Environment value

registerNode

public void registerNode(DirectPastryNode dpn)
Registers a node handle with the simulator.

Parameters:
dpn - DESCRIBE THE PARAMETER

isAlive

public boolean isAlive(DirectNodeHandle nh)
Checks to see if a node id is alive.

Parameters:
nh - DESCRIBE THE PARAMETER
Returns:
true if alive, false otherwise.

proximity

public int proximity(DirectNodeHandle a,
                     DirectNodeHandle b)
Determines proximity between two nodes.

Parameters:
a - a node id.
b - another node id.
Returns:
proximity of b to a.

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay)
Deliver message.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
delay - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node,
                                       int delay,
                                       int period)
Deliver message.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
period - to deliver the message after the delay
delay - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessageFixedRate

public ScheduledMessage deliverMessageFixedRate(Message msg,
                                                DirectPastryNode node,
                                                int delay,
                                                int period)
Deliver message.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
period - to deliver the message after the delay
delay - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

deliverMessage

public ScheduledMessage deliverMessage(Message msg,
                                       DirectPastryNode node)
Deliver message ASAP.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
Returns:
DESCRIBE THE RETURN VALUE

setTestRecord

public void setTestRecord(TestRecord tr)
Sets the TestRecord attribute of the NetworkSimulator object

Parameters:
tr - The new TestRecord value

getTestRecord

public TestRecord getTestRecord()
Gets the TestRecord attribute of the NetworkSimulator object

Returns:
The TestRecord value

getClosest

public DirectNodeHandle getClosest(DirectNodeHandle nh)
Returns the closest Node in proximity.

Parameters:
nh - DESCRIBE THE PARAMETER
Returns:

destroy

public void destroy(DirectPastryNode dpn)
DESCRIBE THE METHOD

Parameters:
dpn - DESCRIBE THE PARAMETER

generateNodeRecord

public NodeRecord generateNodeRecord()
Generates a random node record

Returns:

removeNode

public void removeNode(DirectPastryNode node)
DESCRIBE THE METHOD

Parameters:
node - DESCRIBE THE PARAMETER

start

public void start()
DESCRIBE THE METHOD


stop

public void stop()
DESCRIBE THE METHOD


enqueueDelivery

public CancellableTask enqueueDelivery(Delivery del)
Deliver message.

Parameters:
del - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection