Rice Pastry API

org.mpisws.p2p.transport.direct
Interface GenericNetworkSimulator<Identifier,MessageType>

All Superinterfaces:
LivenessProvider<Identifier>, LivenessTypes
All Known Implementing Classes:
BasicNetworkSimulator

public interface GenericNetworkSimulator<Identifier,MessageType>
extends LivenessProvider<Identifier>


Field Summary
 
Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED
 
Method Summary
 Cancellable deliverMessage(MessageType msg, Identifier to, Identifier from, int delay)
          Deliver message.
 CancellableTask enqueueDelivery(Delivery del, int delay)
          Deliver message.
 Environment getEnvironment()
           
 Environment getEnvironment(Identifier i)
          Get the environment related to a specific node.
 RandomSource getRandomSource()
           
 DirectTransportLayer<Identifier,MessageType> getTL(Identifier i)
           
 boolean isAlive(Identifier i)
           
 float networkDelay(Identifier a, Identifier b)
          Determines delivery time from a to b.
 void remove(Identifier i)
          Kill identifier.
 void setFullSpeed()
          unlimited maxSpeed
 void setMaxSpeed(float rate)
          The max rate of the simulator compared to realtime.
 void start()
           
 void stop()
           
 
Methods inherited from interface org.mpisws.p2p.transport.liveness.LivenessProvider
addLivenessListener, checkLiveness, clearState, getLiveness, removeLivenessListener
 

Method Detail

getEnvironment

Environment getEnvironment()

getEnvironment

Environment getEnvironment(Identifier i)
Get the environment related to a specific node.

Parameters:
i -
Returns:

networkDelay

float networkDelay(Identifier a,
                   Identifier b)
Determines delivery time from a to b.

Parameters:
a - a node id.
b - another node id.
Returns:
delay of b from a.

deliverMessage

Cancellable deliverMessage(MessageType msg,
                           Identifier to,
                           Identifier from,
                           int delay)
Deliver message.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
how - long to delay to deliver the message

enqueueDelivery

CancellableTask enqueueDelivery(Delivery del,
                                int delay)
Deliver message.

Parameters:
msg - message to deliver.
node - the Pastry node to deliver it to.
how - long to delay to deliver the message
period - to deliver the message after the delay

getTL

DirectTransportLayer<Identifier,MessageType> getTL(Identifier i)

isAlive

boolean isAlive(Identifier i)

remove

void remove(Identifier i)
Kill identifier.

Parameters:
i -

start

void start()

stop

void stop()

setMaxSpeed

void setMaxSpeed(float rate)
The max rate of the simulator compared to realtime. The rule is that the simulated clock will not be set to a value greater than the factor from system-time that the call was made. Thus if 1 hour ago, you said the simulator should run at 10x realtime the simulated clock will only have advanced 10 hours. Note that if the simulator cannot keep up with the system clock in the early part, it may move faster than the value you set to "catch up" To prevent this speed-up from becoming unbounded, you may wish to call setMaxSpeed() periodically or immediately after periods of expensive calculations. Setting the simulation speed to zero will not pause the simulation, you must call stop() to do that.

Parameters:
the - multiple on realtime that the simulator is allowed to run at, zero or less will cause no bound on the simulation speed

setFullSpeed

void setFullSpeed()
unlimited maxSpeed


getRandomSource

RandomSource getRandomSource()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection