dd.api
Class DDRouteMsg

java.lang.Object
  |
  +--dd.api.DDRouteMsg
All Implemented Interfaces:
QueueElementIF, QuickSerializable
Direct Known Subclasses:
DDHowto.Ping, DDHowto.Pong, DDMacRouteMsg, DDRepairObjReq, DDRepairObjResp, HelloWorldRouteMsg, HelloWorldRouteMsg, HelloWorldRouteMsg, HostHbStage.Ping, HostHbStage.Pong, RepairDirectoryTest2.RepairReq, RepairDirectoryTest2.RepairResp, TriggerTester.FoundMsg, TriggerTester.RepairReq, TriggerTester.RepairResp

public abstract class DDRouteMsg
extends Object
implements QueueElementIF, QuickSerializable

Messages sent from one machine to any other. To send a message from one OceanStore machine to any other, one simply inherits from this class, filling in the proper serialization code for the inherited class's data. (The DD stage will take care of the fields in this class itself.)

Implementation-wise, this is simply a route-to-root operation.

Version:
$Id: DDRouteMsg.java,v 1.4 2004/05/06 18:10:12 hweather Exp $
Author:
Sean C. Rhea

Field Summary
 boolean dd_intermediate_upcall
          If true, the underlying DHT will generate an upcall event to the DD on each intermediate node in the path.
 int hopCount
          Number of hops taken by the message on its way to the application.
 boolean inbound
          Whether this message is being received (true) or sent (false).
 boolean one_hop
          One hop is a (possible) optimization.
 SecureHash peer
          If inbound, the sender; if !
 boolean recursive_route
          If true recursive route between src and dest; otherwise, iterative route.
 int TTL
          Number of hops this message should take before delivering payload.
 
Constructor Summary
protected DDRouteMsg()
          Empty constructor.
protected DDRouteMsg(InputBuffer buffer)
          Constructs a DDRouteMsg from its serialized form.
protected DDRouteMsg(SecureHash peer, boolean recursive_route, boolean dd_intermediate_upcall, boolean one_hop)
          Constructor: Creates a new DDRouteMsg.
 
Method Summary
 void serialize(OutputBuffer buffer)
          Specified by ostore.util.QuickSerializable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peer

public SecureHash peer
If inbound, the sender; if ! inbound the intended recipient.


inbound

public boolean inbound
Whether this message is being received (true) or sent (false).


recursive_route

public boolean recursive_route
If true recursive route between src and dest; otherwise, iterative route. Recursive route means that each node in the path forwards the message to the next node. The recursive route continues until the message reaches the dest. Whereas, iterative route means each node in the path sends back to the source the next node and the source itself sends the message to the next node. The iterative route continues until the message reaches the dest.


dd_intermediate_upcall

public boolean dd_intermediate_upcall
If true, the underlying DHT will generate an upcall event to the DD on each intermediate node in the path. Otherwise, the underlying DHT will send the message directly to the dest. dd_intermediate_upcall==true is necessary for hopCount and TTL to be accounted for correctly; otherwise, the values are undefined.


one_hop

public boolean one_hop
One hop is a (possible) optimization. Since the DD maintains a host db, it is possible to look up the peer entry in the the db. If an entry exists, the can forward the message directly to the peer in one hop.


hopCount

public int hopCount
Number of hops taken by the message on its way to the application.


TTL

public int TTL
Number of hops this message should take before delivering payload.

Constructor Detail

DDRouteMsg

protected DDRouteMsg(SecureHash peer,
                     boolean recursive_route,
                     boolean dd_intermediate_upcall,
                     boolean one_hop)
Constructor: Creates a new DDRouteMsg. Use for new outbound messages.

An example parameter setting to account for hopCount and TTL:

Another example parameter setting to route as quickly as possible where for hopCount and TTL do not matter:

Parameters:
peer - target destination node guid.
recursive_route - If true recursive route between src and dest; otherwise, iterative route. See recursive_route for more details.
dd_intermediate_upcall - If true, the underlying DHT will generate an upcall event to the DD on each intermediate node in the path. Otherwise, the underlying DHT will send the message directly to the dest. dd_intermediate_upcall==true is necessary for hopCount and TTL to be accounted for correctly; otherwise, the values are undefined.
one_hop - One hop is a (possible) optimization. Since the DD maintains a host db, it is possible to look up the peer entry in the the db. If an entry exists, the can forward the message directly to the peer in one hop.

DDRouteMsg

protected DDRouteMsg()
Empty constructor. For use by derived types when reconstructing themselves from a byte array.


DDRouteMsg

protected DDRouteMsg(InputBuffer buffer)
Constructs a DDRouteMsg from its serialized form.

Parameters:
buffer - serialized form of object.
Method Detail

serialize

public void serialize(OutputBuffer buffer)
Specified by ostore.util.QuickSerializable

Specified by:
serialize in interface QuickSerializable