|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbamboo.util.StandardStage
bamboo.router.Router
public class Router
The routing and dynamic ring maintenance code for Bamboo.
| Nested Class Summary | |
|---|---|
protected static class |
Router.AppData
|
protected static class |
Router.ApplicationInfo
|
static class |
Router.DuplicateApplicationException
Thrown if registerApplication(long, bamboo.util.Curry.Thunk2 is called with a duplicate
application ID. |
static interface |
Router.LookupCb
|
protected static interface |
Router.NetMsgResultCB
|
protected class |
Router.PartitionCheckCB
|
protected static class |
Router.PendingLookupInfo
|
protected class |
Router.PeriodicPingCB
|
protected class |
Router.ProbePingCB
|
protected class |
Router.RecursiveRouteCB
|
protected class |
Router.SecondChancePingCB
|
| Fields inherited from class bamboo.util.StandardStage |
|---|
acore, classifier, DEBUG, event_types, inb_msg_types, logger, my_node_id, my_sink, outb_msg_types, sim_running |
| Constructor Summary | |
|---|---|
Router()
|
|
| Method Summary | |
|---|---|
protected void |
add_to_down_nodes(ostore.util.NodeId n)
Deprecated. |
protected boolean |
add_to_ls_ping_time(NeighborInfo ni,
double rtt_ms)
|
protected void |
add_to_ls(NeighborInfo ni)
|
protected void |
add_to_rrt(NeighborInfo ni)
|
protected boolean |
add_to_rt_ping_time(NeighborInfo ni,
double rtt_ms)
|
protected void |
add_to_rt(NeighborInfo ni)
|
static long |
app_id(Class clazz)
Deprecated. Use the applicationID(java.lang.Class) function instead. |
protected void |
application_enqueue(SinkIF sink,
QueueElementIF item)
|
static long |
applicationID(Class clazz)
Computes an app_id based on the class name for convenience. |
BigInteger |
calc_dist(BigInteger a,
BigInteger b)
|
protected NeighborInfo |
calc_next_hop(BigInteger guid,
boolean use_lc)
|
protected int |
config_get_seconds(ConfigDataIF config,
String name,
int default_value)
|
protected void |
deliver(BigInteger src,
BigInteger dest,
ostore.util.NodeId is,
long app_id,
int tries,
long wait_ms,
long est_rtt_ms,
ostore.util.QuickSerializable payload)
|
int |
digitsPerID()
The number of digits per identifier being used by this router. |
protected int |
est_hops_to_go(BigInteger guid,
boolean use_lc)
|
protected void |
generic_msg_failure(NeighborInfo ni,
Runnable retry)
|
protected void |
generic_msg_success(NeighborInfo ni)
|
protected void |
handle_join_req(JoinReq req)
|
protected void |
handle_join_resp(JoinResp resp)
|
protected void |
handle_leaf_set_changed(LeafSetChanged msg)
|
protected void |
handle_leaf_set_req(LeafSetReq req)
|
protected void |
handle_lookup_resp_msg(LookupRespMsg resp)
|
protected void |
handle_monitor_node_down(NeighborInfo ni)
|
protected void |
handle_net_lat_resp(ostore.network.NetworkLatencyResp resp)
|
protected void |
handle_net_msg_result(ostore.network.NetworkMessageResult result)
|
protected void |
handle_route_continue(BambooRouteContinue req)
|
protected void |
handle_route_init(BambooRouteInit req)
|
protected void |
handle_route_msg(RouteMsg req)
|
protected void |
handle_router_app_reg_req(BambooRouterAppRegReq req)
|
protected void |
handle_routing_table_req(RoutingTableReq req)
|
protected void |
handle_routing_table_resp(RoutingTableResp resp)
|
protected void |
handle_rt_annc(RoutingNeighborAnnounce annc)
|
void |
handleEvent(QueueElementIF item)
|
protected boolean |
have_rtt_ms(NeighborInfo ni)
|
BigInteger |
id()
The identifier of this node. |
void |
init(ConfigDataIF config)
|
static Router |
instance(ostore.util.NodeId nodeID)
Returns the Router stage for a given Bamboo node. |
void |
lookup(BigInteger id,
Router.LookupCb cb,
Object user_data)
|
BigInteger |
modulus()
One larger than the largest identifier supported by the system. |
protected void |
notify_leaf_set_changed()
|
protected void |
notify_leaf_set_changed(Router.ApplicationInfo onlyThisOne)
|
protected void |
notify_reverse_routing_table_changed(BambooNeighborInfo[] added,
BambooNeighborInfo[] removed)
|
protected void |
notify_routing_table_changed(BambooNeighborInfo[] added,
BambooNeighborInfo[] removed)
|
protected long |
randomPeriod(int mean)
|
void |
registerApplication(long id,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> leafSetChanged,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> routingTableChanged,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> reverseRoutingTableChanged,
Curry.Thunk6<BigInteger,BigInteger,ostore.util.NodeId,Long,Long,ostore.util.QuickSerializable> routeUpcall,
Curry.Thunk6<BigInteger,BigInteger,ostore.util.NodeId,Long,Long,ostore.util.QuickSerializable> routeDeliver)
Register an application (such as bamboo.dht.Dht) to use the Router. |
protected boolean |
remove_from_ls(NeighborInfo ni)
|
protected boolean |
remove_from_rrt(NeighborInfo ni)
|
protected boolean |
remove_from_rt(NeighborInfo ni)
|
void |
routeContinue(BigInteger src,
BigInteger dest,
ostore.util.NodeId immediateSource,
long applicationID,
boolean intermediateUpcall,
ostore.util.QuickSerializable payload)
Coninue a routing operation after an upcall. |
void |
routeInit(BigInteger dest,
long applicationID,
boolean intermediateUpcall,
ostore.util.QuickSerializable payload)
Initiate a routing operation to dest. |
protected double |
rtt_ms(NeighborInfo ni)
|
protected void |
send_ping(NeighborInfo ni)
|
protected void |
set_initialized()
|
protected void |
use_as_periodic_ping(NeighborInfo ni,
ostore.network.NetworkMessage outb)
|
int |
valuesPerDigit()
The number of values per digit in each identifier being used by this router. |
protected int |
weighted_random_rt_level()
|
| Methods inherited from class bamboo.util.StandardStage |
|---|
BUG, BUG, BUG, config_get_boolean, config_get_double, config_get_int, config_get_string, configGetInt, destroy, dispatch, enqueue, handleEvents, lookup_stage, now_ms, timer_ms |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Map<ostore.util.NodeId,Router> instances
protected Map<Long,Router.ApplicationInfo> apps
protected BigInteger MODULUS
protected int GUID_DIGITS
protected int GUID_BITS
protected int DIGIT_VALUES
protected int DIGIT_BITS
protected static final int PING_ITER
protected boolean PNS
protected boolean ignore_possibly_down
protected boolean no_rexmit_routes
protected Map<NeighborInfo,Double> latency_map
protected Map<NeighborInfo,Long> possibly_down
protected Set<NeighborInfo> periodic_pings
protected BigInteger my_guid
protected int[] my_digits
protected NeighborInfo my_neighbor_info
protected boolean initialized
protected LinkedList<QueueElementIF> waitq
protected LocationCache location_cache
protected Set<ostore.util.NodeId> down_nodes
protected int down_nodes_cap
protected boolean immediate_join
protected LeafSet leaf_set
protected int leaf_set_size
protected RoutingTable rt
protected LinkedList<ostore.util.NodeId> gateways
protected Random rand
protected int periodic_ping_period
protected int partition_check_alarm_period
protected int ls_alarm_period
protected int near_rt_alarm_period
protected int far_rt_alarm_period
protected int lookup_rt_alarm_period
protected boolean pastry_mode
protected long start_time_ms
protected Set<NeighborInfo> reverse_rt
protected Runnable pingAlarm
protected Runnable partitionCheckAlarm
protected Runnable leafSetAlarm
protected Runnable ready
protected Runnable nearRoutingTableAlarm
protected static final int[] bit_select
protected Runnable farRoutingTableAlarm
protected Runnable lookupRoutingTableAlarm
protected Curry.Thunk3<Integer,Integer,Integer> joinAlarm
protected Set<NeighborInfo> pings_in_flight
protected Map<BigInteger,Router.PendingLookupInfo> pending_lookups
protected Curry.Thunk1<BigInteger> lookupTimeout
| Constructor Detail |
|---|
public Router()
throws Exception
Exception| Method Detail |
|---|
public static Router instance(ostore.util.NodeId nodeID)
public static final long app_id(Class clazz)
applicationID(java.lang.Class) function instead.
public static final long applicationID(Class clazz)
public void registerApplication(long id,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> leafSetChanged,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> routingTableChanged,
Curry.Thunk2<BambooNeighborInfo[],BambooNeighborInfo[]> reverseRoutingTableChanged,
Curry.Thunk6<BigInteger,BigInteger,ostore.util.NodeId,Long,Long,ostore.util.QuickSerializable> routeUpcall,
Curry.Thunk6<BigInteger,BigInteger,ostore.util.NodeId,Long,Long,ostore.util.QuickSerializable> routeDeliver)
throws Router.DuplicateApplicationException
id - A value to identify this application in route messages sent
across the network.leafSetChanged - Called when the leaf set changes. The first
array is the new predecessor list; the second is the new successor
list.routingTableChanged - Called when the routing table changes. The
first array is the nodes added to the routing table; the second is
those removed from the routing table.reverseRoutingTableChanged - Called when we are added to or
removed from some other node's routing table. The first array is the
nodes added to the routing table; the second is those removed from the
routing table.routeUpcall - Called when a message is routed through this node,
and the source specified that it should upcall at nodes that are not
the root of the destination ID. The arguments are source ID,
destination ID, immediate source IP:port, the queuing time before the
message was forwarded, the estimated round trip time from the immediate
source to this node, and the payload.routeDeliver - Called when we are the root for a route message.
The arguments are source ID, destination ID, immediate source IP:port,
the queuing time before the message was forwarded, the estimated round
trip time from the immediate source to this node, and the payload.
Router.DuplicateApplicationException - if
registerApplication has already been called with this
idpublic BigInteger id()
public BigInteger modulus()
public int digitsPerID()
public int valuesPerDigit()
public void routeInit(BigInteger dest,
long applicationID,
boolean intermediateUpcall,
ostore.util.QuickSerializable payload)
dest. Place the message
to be sent in payload. To receive the message, the node
responsible for dest must have registered an application
(see registerApplication) with the given
applicationID. If intermediateUpcall is
true, a the routeUpcall function object given in that call
to registerApplication will be called on each intermediate
node in the path. To continue the routing operation, that node must
call routeContinue. Finally, the
routeDeliver function object given in the call to
registerApplication will be called once the message
reaches the node responsible for dest.
public void routeContinue(BigInteger src,
BigInteger dest,
ostore.util.NodeId immediateSource,
long applicationID,
boolean intermediateUpcall,
ostore.util.QuickSerializable payload)
routeInit(java.math.BigInteger, long, boolean, ostore.util.QuickSerializable) for more information.
protected int config_get_seconds(ConfigDataIF config,
String name,
int default_value)
public void init(ConfigDataIF config)
throws Exception
init in interface EventHandlerIFinit in class StandardStageExceptionpublic void handleEvent(QueueElementIF item)
handleEvent in interface EventHandlerIFhandleEvent in class StandardStageprotected void handle_net_msg_result(ostore.network.NetworkMessageResult result)
protected long randomPeriod(int mean)
protected void use_as_periodic_ping(NeighborInfo ni,
ostore.network.NetworkMessage outb)
protected void generic_msg_success(NeighborInfo ni)
protected void generic_msg_failure(NeighborInfo ni,
Runnable retry)
protected void handle_rt_annc(RoutingNeighborAnnounce annc)
protected void handle_monitor_node_down(NeighborInfo ni)
protected void handle_leaf_set_req(LeafSetReq req)
protected void handle_leaf_set_changed(LeafSetChanged msg)
protected void handle_router_app_reg_req(BambooRouterAppRegReq req)
protected void application_enqueue(SinkIF sink,
QueueElementIF item)
protected void deliver(BigInteger src,
BigInteger dest,
ostore.util.NodeId is,
long app_id,
int tries,
long wait_ms,
long est_rtt_ms,
ostore.util.QuickSerializable payload)
protected void handle_route_continue(BambooRouteContinue req)
protected void handle_route_init(BambooRouteInit req)
protected void handle_route_msg(RouteMsg req)
protected void set_initialized()
protected int weighted_random_rt_level()
protected void handle_lookup_resp_msg(LookupRespMsg resp)
protected void handle_routing_table_req(RoutingTableReq req)
protected void handle_routing_table_resp(RoutingTableResp resp)
protected void notify_routing_table_changed(BambooNeighborInfo[] added,
BambooNeighborInfo[] removed)
protected void notify_reverse_routing_table_changed(BambooNeighborInfo[] added,
BambooNeighborInfo[] removed)
protected void notify_leaf_set_changed()
protected void notify_leaf_set_changed(Router.ApplicationInfo onlyThisOne)
protected void handle_join_req(JoinReq req)
protected void handle_join_resp(JoinResp resp)
protected void send_ping(NeighborInfo ni)
protected void handle_net_lat_resp(ostore.network.NetworkLatencyResp resp)
protected void add_to_ls(NeighborInfo ni)
protected boolean add_to_ls_ping_time(NeighborInfo ni,
double rtt_ms)
protected boolean remove_from_ls(NeighborInfo ni)
protected void add_to_rt(NeighborInfo ni)
protected boolean add_to_rt_ping_time(NeighborInfo ni,
double rtt_ms)
protected boolean remove_from_rt(NeighborInfo ni)
protected void add_to_rrt(NeighborInfo ni)
protected boolean remove_from_rrt(NeighborInfo ni)
protected boolean have_rtt_ms(NeighborInfo ni)
protected double rtt_ms(NeighborInfo ni)
protected NeighborInfo calc_next_hop(BigInteger guid,
boolean use_lc)
protected int est_hops_to_go(BigInteger guid,
boolean use_lc)
public BigInteger calc_dist(BigInteger a,
BigInteger b)
protected void add_to_down_nodes(ostore.util.NodeId n)
node which is running
in this JVMand a guid, it returns whether the
node is the owner of the guid.
public void lookup(BigInteger id,
Router.LookupCb cb,
Object user_data)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||