|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.direct.BasicNetworkSimulator
public abstract class BasicNetworkSimulator
Field Summary | |
---|---|
protected Logger |
logger
|
protected SelectorManager |
manager
|
protected int |
maxDiameter
|
protected int |
MIN_DELAY
|
protected int |
minDelay
|
protected RandomSource |
random
|
Constructor Summary | |
---|---|
BasicNetworkSimulator(Environment env)
|
Method Summary | |
---|---|
boolean |
addSimulatorListener(SimulatorListener sl)
|
ScheduledMessage |
deliverMessage(Message msg,
DirectPastryNode node)
node should always be a local node, because this will be delivered instantly |
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 node)
set the liveliness of a NodeId |
CancellableTask |
enqueueDelivery(Delivery d,
int delay)
Deliver message. |
DirectNodeHandle |
getClosest(DirectNodeHandle nh)
find the closest NodeId to an input NodeId out of all NodeIds in the network |
Environment |
getEnvironment()
|
TestRecord |
getTestRecord()
get TestRecord |
boolean |
isAlive(DirectNodeHandle nh)
testing if a NodeId is alive |
float |
networkDelay(DirectNodeHandle a,
DirectNodeHandle b)
computes the proximity between two NodeIds |
void |
notifySimulatorListeners(Message m,
NodeHandle from,
NodeHandle to,
int delay)
Call this when a message is sent. |
float |
proximity(DirectNodeHandle a,
DirectNodeHandle b)
Determines rtt between two nodes. |
void |
registerNode(DirectPastryNode dpn)
Registers a node handle with the simulator. |
void |
removeNode(DirectPastryNode node)
|
boolean |
removeSimulatorListener(SimulatorListener sl)
|
void |
setFullSpeed()
unlimited maxSpeed |
void |
setMaxSpeed(float speed)
The max rate of the simulator compared to realtime. |
void |
setTestRecord(TestRecord tr)
set TestRecord |
void |
start()
|
void |
stop()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface rice.pastry.direct.NetworkSimulator |
---|
generateNodeRecord |
Field Detail |
---|
protected Logger logger
protected RandomSource random
protected int MIN_DELAY
protected SelectorManager manager
protected final int maxDiameter
protected final int minDelay
Constructor Detail |
---|
public BasicNetworkSimulator(Environment env)
Method Detail |
---|
public void start()
start
in interface NetworkSimulator
public void stop()
stop
in interface NetworkSimulator
public TestRecord getTestRecord()
getTestRecord
in interface NetworkSimulator
public void setTestRecord(TestRecord tr)
setTestRecord
in interface NetworkSimulator
tr
- input TestRecordpublic CancellableTask enqueueDelivery(Delivery d, int delay)
NetworkSimulator
enqueueDelivery
in interface NetworkSimulator
public ScheduledMessage deliverMessage(Message msg, DirectPastryNode node)
deliverMessage
in interface NetworkSimulator
msg
- message to deliver.node
- the Pastry node to deliver it to.public ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay)
NetworkSimulator
deliverMessage
in interface NetworkSimulator
msg
- message to deliver.node
- the Pastry node to deliver it to.public ScheduledMessage deliverMessage(Message msg, DirectPastryNode node, int delay, int period)
NetworkSimulator
deliverMessage
in interface NetworkSimulator
msg
- message to deliver.node
- the Pastry node to deliver it to.period
- to deliver the message after the delaypublic ScheduledMessage deliverMessageFixedRate(Message msg, DirectPastryNode node, int delay, int period)
NetworkSimulator
deliverMessageFixedRate
in interface NetworkSimulator
msg
- message to deliver.node
- the Pastry node to deliver it to.period
- to deliver the message after the delaypublic void setMaxSpeed(float speed)
NetworkSimulator
setMaxSpeed
in interface NetworkSimulator
public void setFullSpeed()
NetworkSimulator
setFullSpeed
in interface NetworkSimulator
public boolean isAlive(DirectNodeHandle nh)
isAlive
in interface NetworkSimulator
nid
- the NodeId being tested
public void destroy(DirectPastryNode node)
destroy
in interface NetworkSimulator
nid
- the NodeId being setalive
- the value being setpublic float networkDelay(DirectNodeHandle a, DirectNodeHandle b)
networkDelay
in interface NetworkSimulator
a
- the first NodeIdb
- the second NodeId
public float proximity(DirectNodeHandle a, DirectNodeHandle b)
NetworkSimulator
proximity
in interface NetworkSimulator
a
- a node id.b
- another node id.
public DirectNodeHandle getClosest(DirectNodeHandle nh)
getClosest
in interface NetworkSimulator
nid
- the input NodeId
public void registerNode(DirectPastryNode dpn)
NetworkSimulator
registerNode
in interface NetworkSimulator
public void removeNode(DirectPastryNode node)
removeNode
in interface NetworkSimulator
public Environment getEnvironment()
getEnvironment
in interface NetworkSimulator
public boolean addSimulatorListener(SimulatorListener sl)
addSimulatorListener
in interface NetworkSimulator
public boolean removeSimulatorListener(SimulatorListener sl)
removeSimulatorListener
in interface NetworkSimulator
public void notifySimulatorListeners(Message m, NodeHandle from, NodeHandle to, int delay)
NetworkSimulator
notifySimulatorListeners
in interface NetworkSimulator
m
- the messagefrom
- the sourceto
- the destinationdelay
- the network proximity (when the message will be received)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |