ostore.tapestry.impl
Class RoutingTable
java.lang.Object
|
+--ostore.tapestry.impl.RoutingTable
- public class RoutingTable
- extends Object
Implements the routing table interface.
- Version:
- $Id: RoutingTable.java,v 1.7 2002/03/27 00:08:07 ravenben Exp $
- Author:
- Ben Y. Zhao
Method Summary |
void |
addBackup(int digit,
int value,
NodeId nid,
Long latency,
SecureHash guid)
Add alternate/backup routes to the routing table |
void |
addDistance(long rtt,
NodeId nid,
SecureHash newguid)
Method to add the latency measurement to the data structures |
void |
addSelf(SecureHash self)
|
int |
bits_per_digit()
|
int |
digit_values()
|
int |
digits_per_guid()
|
static int[] |
digits(SecureHash h)
|
RouteEntry |
getEntry(int digit,
int value)
|
SecureHash |
node_id_to_guid(NodeId node_id)
|
void |
optimize(long delta,
NodeId nid,
SecureHash newguid)
|
String |
printGuid(SecureHash x)
|
NodeId |
read(int which_digit,
int digit_value)
|
NodeId |
surrogate(int[] dest_digits,
int dest_digit,
int hop)
Find the surrogate for an empty routing table entry. |
String |
toString()
|
void |
write(int which_digit,
int digit_value,
NodeId node_id,
SecureHash node_guid,
Long latency)
|
BITS_PER_DIGIT
public static final int BITS_PER_DIGIT
DIGITS_PER_GUID
public static final int DIGITS_PER_GUID
DIGIT_VALUES
public static final int DIGIT_VALUES
RoutingTable
public RoutingTable(NodeId self_node_id)
digit_values
public int digit_values()
digits_per_guid
public int digits_per_guid()
bits_per_digit
public int bits_per_digit()
node_id_to_guid
public SecureHash node_id_to_guid(NodeId node_id)
read
public NodeId read(int which_digit,
int digit_value)
write
public void write(int which_digit,
int digit_value,
NodeId node_id,
SecureHash node_guid,
Long latency)
optimize
public void optimize(long delta,
NodeId nid,
SecureHash newguid)
- Parameters:
newguid
- The guid of some nodenid
- The nodeid of that nodedelta
- is the estimated RTT distance from us to that node
addBackup
public void addBackup(int digit,
int value,
NodeId nid,
Long latency,
SecureHash guid)
- Add alternate/backup routes to the routing table
- Parameters:
digit
- digit of entry being addedvalue
- value of entry's Guid at the relevant digitnid
- NodeId of entry being addedlatency
- Last tested latency of new entryguid
- Guid of new entry
getEntry
public RouteEntry getEntry(int digit,
int value)
addDistance
public void addDistance(long rtt,
NodeId nid,
SecureHash newguid)
- Method to add the latency measurement to the data structures
- Parameters:
rtt
- Estimated roundtrip distancenid
- NodeId of new nodenewguid
- Guid of new node
surrogate
public NodeId surrogate(int[] dest_digits,
int dest_digit,
int hop)
- Find the surrogate for an empty routing table entry.
- Parameters:
dest_digits
- The array of ints representing the destination guiddest_digit
- The digit value that points to an empty entryhop
- Which hop are we looking for the surrogate route on- Returns:
null
if we are definitely the
surrogate, and the NodeId
of the
next person to ask if we cannot tell from this
hop yet.
addSelf
public void addSelf(SecureHash self)
digits
public static int[] digits(SecureHash h)
toString
public String toString()
- Overrides:
toString
in class Object
printGuid
public String printGuid(SecureHash x)