Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.direct
Class BasicNetworkSimulator<Identifier,MessageType>

    java.lang.Object
      org.mpisws.p2p.transport.direct.EventSimulator
          rice.pastry.direct.BasicNetworkSimulator<Identifier,MessageType>

All Implemented Interfaces:
  GenericNetworkSimulator<Identifier,MessageType>, LivenessProvider<Identifier>

    public class BasicNetworkSimulator<Identifier,MessageType>

extends EventSimulator
implements GenericNetworkSimulator<Identifier,MessageType>

Field Summary
`protected int` | `maxDiameter`
`protected int` | `MIN_DELAY`
`protected int` | `minDelay`

Fields inherited from class org.mpisws.p2p.transport.direct.EventSimulator
`environment, logger, manager, random, timeSource`

Constructor Summary
`BasicNetworkSimulator(Environment env, RandomSource random)`

Method Summary
`void` | `addLivenessListener(LivenessListener<Identifier> name)`
`boolean` | `checkLiveness(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)` Returns wether a new notification will occur.
`void` | `clearState(Identifier i)` Force layer to clear the existing state related to the Identifier.
`Cancellable` | `deliverMessage(MessageType msg, Identifier node, Identifier from)` node should always be a local node, because this will be delivered instantly
`Cancellable` | `deliverMessage(MessageType msg, Identifier node, Identifier from, int delay)` Deliver message.
`Cancellable` | `deliverMessage(MessageType msg, Identifier node, Identifier from, int delay, int period)`
`Cancellable` | `deliverMessageFixedRate(MessageType msg, Identifier node, Identifier from, int delay, int period)`
`CancellableTask` | `enqueueDelivery(Delivery d, int delay)` Deliver message.
`Environment` | `getEnvironment()`
`int` | `getLiveness(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)`
`NodeRecord` | `getNodeRecord(DirectNodeHandle handle)`
`RandomSource` | `getRandomSource()`
`DirectTransportLayer<Identifier,MessageType>` | `getTL(Identifier i)`
`boolean` | `isAlive(Identifier i)`
`float` | `networkDelay(Identifier a, Identifier b)` computes the one-way distance between two NodeIds
`float` | `proximity(Identifier a, Identifier b)` computes the rtt between two NodeIds
`void` | `registerIdentifier(Identifier i, DirectTransportLayer<Identifier,MessageType> dtl, NodeRecord record)` set the liveliness of a NodeId
`void` | `remove(Identifier i)` Kill identifier.
`boolean` | `removeLivenessListener(LivenessListener<Identifier> name)`

Methods inherited from class org.mpisws.p2p.transport.direct.EventSimulator
`setFullSpeed, setMaxSpeed, simulate, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.mpisws.p2p.transport.direct.GenericNetworkSimulator
`setFullSpeed, setMaxSpeed, start, stop`

Field Detail

### MIN_DELAY

    protected int MIN_DELAY

### maxDiameter

    protected final int maxDiameter

### minDelay

    protected final int minDelay

Constructor Detail

### BasicNetworkSimulator

    public BasicNetworkSimulator(Environment env,
                                 RandomSource random)

Method Detail

### enqueueDelivery

    public CancellableTask enqueueDelivery(Delivery d,
                                           int delay)

  Description copied from interface: `GenericNetworkSimulator`
  Deliver message.

  Specified by:
    `enqueueDelivery` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### deliverMessage

    public Cancellable deliverMessage(MessageType msg,
                                      Identifier node,
                                      Identifier from)

  node should always be a local node, because this will be delivered instantly

### deliverMessage

    public Cancellable deliverMessage(MessageType msg,
                                      Identifier node,
                                      Identifier from,
                                      int delay)

  Description copied from interface: `GenericNetworkSimulator`
  Deliver message.

  Specified by:
    `deliverMessage` in interface `GenericNetworkSimulator<Identifier,MessageType>`
  Parameters:
    `msg` - message to deliver.

### deliverMessageFixedRate

    public Cancellable deliverMessageFixedRate(MessageType msg,
                                               Identifier node,
                                               Identifier from,
                                               int delay,
                                               int period)

### deliverMessage

    public Cancellable deliverMessage(MessageType msg,
                                      Identifier node,
                                      Identifier from,
                                      int delay,
                                      int period)

### registerIdentifier

    public void registerIdentifier(Identifier i,
                                   DirectTransportLayer<Identifier,MessageType> dtl,
                                   NodeRecord record)

  set the liveliness of a NodeId

  Parameters:
    `nid` - the NodeId being set
    `alive` - the value being set

### remove

    public void remove(Identifier i)

  Description copied from interface: `GenericNetworkSimulator`
  Kill identifier.

  Specified by:
    `remove` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### getEnvironment

    public Environment getEnvironment()

  Specified by:
    `getEnvironment` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### getRandomSource

    public RandomSource getRandomSource()

  Specified by:
    `getRandomSource` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### isAlive

    public boolean isAlive(Identifier i)

  Specified by:
    `isAlive` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### getTL

    public DirectTransportLayer<Identifier,MessageType> getTL(Identifier i)

  Specified by:
    `getTL` in interface `GenericNetworkSimulator<Identifier,MessageType>`

### networkDelay

    public float networkDelay(Identifier a,
                              Identifier b)

  computes the one-way distance between two NodeIds

  Specified by:
    `networkDelay` in interface `GenericNetworkSimulator<Identifier,MessageType>`
  Parameters:
    `a` - the first NodeId
    `b` - the second NodeId
  Returns:
    the proximity between the two input NodeIds

### proximity

    public float proximity(Identifier a,
                           Identifier b)

  computes the rtt between two NodeIds

  Parameters:
    `a` - the first NodeId
    `b` - the second NodeId
  Returns:
    the proximity between the two input NodeIds

### getNodeRecord

    public NodeRecord getNodeRecord(DirectNodeHandle handle)

### addLivenessListener

    public void addLivenessListener(LivenessListener<Identifier> name)

  Specified by:
    `addLivenessListener` in interface `LivenessProvider<Identifier>`

### removeLivenessListener

    public boolean removeLivenessListener(LivenessListener<Identifier> name)

  Specified by:
    `removeLivenessListener` in interface `LivenessProvider<Identifier>`

### checkLiveness

    public boolean checkLiveness(Identifier i,
                                 java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `LivenessProvider`
  Returns wether a new notification will occur. Will return false if a liveness check has recently completed. Will return true if a new liveness check starts, or an existing one is in progress.

  Specified by:
    `checkLiveness` in interface `LivenessProvider<Identifier>`
  Parameters:
    `i` - the node to check
  Returns:
    true if there will be an update (either a ping, or a change in liveness) false if there won't be an update due to bandwidth concernts

### getLiveness

    public int getLiveness(Identifier i,
                           java.util.Map<java.lang.String,java.lang.Object> options)

  Specified by:
    `getLiveness` in interface `LivenessProvider<Identifier>`

### clearState

    public void clearState(Identifier i)

  Description copied from interface: `LivenessProvider`
  Force layer to clear the existing state related to the Identifier. Usually if there is reason to believe a node has returned.

  Specified by:
    `clearState` in interface `LivenessProvider<Identifier>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.