ostore.tapestry.impl
Class Router
java.lang.Object
|
+--ostore.tapestry.impl.Router
- All Implemented Interfaces:
- EventHandlerIF, ProfilableIF
- public class Router
- extends Object
- implements EventHandlerIF, ProfilableIF
Handles the routing functions of Tapestry.
TODO: The back pointers are currently maintained in sorted linked lists
which are sorted by distance. All the elements in a list have the same
guid, and the lists are stored in a map indexed by those guids. I don't
have to tell you that this is inefficient, but I can't get Java's
TreeSet class to replace the lists. I think it has something to do with
what the Javadocs call compare being "compatible with" equals. I don't
know. In any case, the backpointers will need to be stored on disk at
some point, not all in memory, so this will all need an overhauling
then. --srhea, 12/18/2001
- Version:
- $Id: Router.java,v 1.36 2002/04/05 19:08:33 ravenben Exp $
- Author:
- Ben Zhao
Method Summary |
void |
destroy()
|
protected void |
handle_bloom_wrapper(BloomWrapper wrapper)
|
protected void |
handle_publish_msg(PublishMsg msg)
|
protected void |
handle_publish_t_message(ostore.tapestry.PublishTMessage msg)
|
protected void |
handle_route_msg(RouteMsg msg)
|
void |
handle_route_obj_dest_msg(RouteObjDestMsg msg)
|
protected void |
handle_route_obj_root_msg(RouteObjRootMsg msg)
|
protected void |
handle_route_obj_t_message(ostore.tapestry.RouteObjTMessage msg)
|
protected void |
handle_route_t_message(ostore.tapestry.RouteTMessage msg)
|
protected void |
handle_stages_init_signal()
For use in derived classes. |
protected void |
handle_tapestry_locate_msg(TapestryLocateMsg msg)
|
protected void |
handle_tapestry_prefix_route_msg(TapestryPrefixRouteMsg msg)
|
protected void |
handle_tapestry_publish_msg(TapestryPublishMsg msg)
|
protected void |
handle_tapestry_route_msg(TapestryRouteMsg msg)
|
protected void |
handle_tapestry_unpublish_msg(TapestryUnpublishMsg msg)
|
void |
handleEvent(QueueElementIF item)
|
void |
handleEvents(QueueElementIF[] items)
|
void |
init(ConfigDataIF config)
|
int |
profileSize()
|
protected void |
publish(SecureHash src,
SecureHash guid,
TapestryTag ttag,
boolean publish,
NodeId lasthop)
|
protected boolean |
route_to_dest(SecureHash guid,
SecureHash src,
TapestryQuery query,
TapestryQueryState state,
QuickSerializable user_data,
int user_data_length,
int user_data_offset,
long user_data_type,
byte[] user_data_buffer)
|
NodeId |
route_to_root(int[] dest_digits,
boolean exact,
boolean prefix,
int[] digit)
Route to the root of the tree for dest_digits , assuming
that the first digit [0] - 1 digits have already been
accounted for, and return the next node in the routing path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Router
public Router()
init
public void init(ConfigDataIF config)
throws Exception
- Specified by:
init
in interface EventHandlerIF
destroy
public void destroy()
throws Exception
- Specified by:
destroy
in interface EventHandlerIF
profileSize
public int profileSize()
- Specified by:
profileSize
in interface ProfilableIF
handle_stages_init_signal
protected void handle_stages_init_signal()
- For use in derived classes.
handle_route_t_message
protected void handle_route_t_message(ostore.tapestry.RouteTMessage msg)
handle_tapestry_route_msg
protected void handle_tapestry_route_msg(TapestryRouteMsg msg)
handle_tapestry_prefix_route_msg
protected void handle_tapestry_prefix_route_msg(TapestryPrefixRouteMsg msg)
handle_route_msg
protected void handle_route_msg(RouteMsg msg)
handle_publish_t_message
protected void handle_publish_t_message(ostore.tapestry.PublishTMessage msg)
handle_tapestry_publish_msg
protected void handle_tapestry_publish_msg(TapestryPublishMsg msg)
handle_tapestry_unpublish_msg
protected void handle_tapestry_unpublish_msg(TapestryUnpublishMsg msg)
handle_publish_msg
protected void handle_publish_msg(PublishMsg msg)
handle_route_obj_t_message
protected void handle_route_obj_t_message(ostore.tapestry.RouteObjTMessage msg)
handle_bloom_wrapper
protected void handle_bloom_wrapper(BloomWrapper wrapper)
handle_tapestry_locate_msg
protected void handle_tapestry_locate_msg(TapestryLocateMsg msg)
handle_route_obj_root_msg
protected void handle_route_obj_root_msg(RouteObjRootMsg msg)
handle_route_obj_dest_msg
public void handle_route_obj_dest_msg(RouteObjDestMsg msg)
handleEvent
public void handleEvent(QueueElementIF item)
throws EventHandlerException
- Specified by:
handleEvent
in interface EventHandlerIF
route_to_dest
protected boolean route_to_dest(SecureHash guid,
SecureHash src,
TapestryQuery query,
TapestryQueryState state,
QuickSerializable user_data,
int user_data_length,
int user_data_offset,
long user_data_type,
byte[] user_data_buffer)
throws QSException
publish
protected void publish(SecureHash src,
SecureHash guid,
TapestryTag ttag,
boolean publish,
NodeId lasthop)
handleEvents
public void handleEvents(QueueElementIF[] items)
throws EventHandlerException
- Specified by:
handleEvents
in interface EventHandlerIF
route_to_root
public NodeId route_to_root(int[] dest_digits,
boolean exact,
boolean prefix,
int[] digit)
- Route to the root of the tree for
dest_digits
, assuming
that the first digit [0] - 1
digits have already been
accounted for, and return the next node in the routing path.
- Parameters:
dest_digits
- the digits of the destination GUIDexact
- whether this should be an exact match; if this
parameter is true, the function will return
null
if there is no such node.digit
- the digit to start routing from- Returns:
- the next node in the routing path, if any; return
null
if there is no such node and
return _self_node_id
if the current
node is the deterministic root