edu.harvard.syrah.pyxida.nc
Class NCManager

java.lang.Object
  extended by edu.harvard.syrah.pyxida.nc.NCManager

public class NCManager
extends java.lang.Object

Manages the local and proxy coordinates. Initiates gossip to other overlay nodes. Receives and responds to gossip messages. Manages gossip set, e.g. set of overlay nodes that the coordinates might use as neighbors


Field Summary
static long DEFAULT_PROXY_LEASE
          Default lifetime that proxy coordinates are managed for.
static int NC_NUM_DIMS
           
static int SECONDARY_NC_NUM_DIMS
           
static long UPDATE_DELAY
          Time between gossip messages to coordinate neighbors.
static boolean WATCH_NEIGHBORS
           
 
Constructor Summary
NCManager(ObjCommIF _comm, PingManager pingManager)
          Create a coordinate manager.
 
Method Summary
 java.lang.String createProxyCoord(AddressIF remoteNode, long lease)
           
 java.lang.String destroyProxyCoord(AddressIF remoteNode)
           
 void estimateRTT(AddressIF nodeA, AddressIF nodeB,  cbDistance)
          Fetches coordinates from two nodes and returns the distance between them.
 java.util.Set<AddressIF> getDownNeighbours()
           
 Coordinate getLocalCoord()
           
 double getLocalError()
           
 Coordinate getLocalSecondaryCoord()
           
 double getLocalSecondaryError()
           
 java.util.Set<AddressIF> getPendingNeighbours()
           
 Coordinate getProxyCoord(AddressIF remoteNode)
           
 void getRemoteCoord(AddressIF remoteNode,  cbCoord)
          Fetch coordinate from remote node.
 void getRemoteCoords(java.util.List<AddressIF> nodes,  cbCoords)
           
 java.util.Set<AddressIF> getUpNeighbours()
           
 void init(CB0 cbDone)
          Asynchronous initialization of coordinate manager.
 void printStats()
           
 java.lang.String renewLeaseOnProxyCoord(AddressIF remoteNode, long lease)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NC_NUM_DIMS

public static final int NC_NUM_DIMS

SECONDARY_NC_NUM_DIMS

public static final int SECONDARY_NC_NUM_DIMS

WATCH_NEIGHBORS

public static final boolean WATCH_NEIGHBORS

UPDATE_DELAY

public static final long UPDATE_DELAY
Time between gossip messages to coordinate neighbors. Default is 10 seconds.

See Also:
Constant Field Values

DEFAULT_PROXY_LEASE

public static final long DEFAULT_PROXY_LEASE
Default lifetime that proxy coordinates are managed for. Set to one hour.

See Also:
Constant Field Values
Constructor Detail

NCManager

public NCManager(ObjCommIF _comm,
                 PingManager pingManager)
Create a coordinate manager. Does not block.

Method Detail

init

public void init(CB0 cbDone)
Asynchronous initialization of coordinate manager. Resolves bootstrap neighbors and starts gossip for local coordinate. Starts listening for gossip messages.


printStats

public void printStats()

createProxyCoord

public java.lang.String createProxyCoord(AddressIF remoteNode,
                                         long lease)

renewLeaseOnProxyCoord

public java.lang.String renewLeaseOnProxyCoord(AddressIF remoteNode,
                                               long lease)

getProxyCoord

public Coordinate getProxyCoord(AddressIF remoteNode)
Returns:
Coordinate for this remoteNode if we are storing one.

destroyProxyCoord

public java.lang.String destroyProxyCoord(AddressIF remoteNode)
Returns:
result of proxy coordinate removal

getLocalCoord

public Coordinate getLocalCoord()
Returns:
local coordinate

getLocalError

public double getLocalError()
Returns:
local error

getLocalSecondaryCoord

public Coordinate getLocalSecondaryCoord()

getLocalSecondaryError

public double getLocalSecondaryError()
Returns:
local error

getRemoteCoord

public void getRemoteCoord(AddressIF remoteNode,
                            cbCoord)
Fetch coordinate from remote node.


getRemoteCoords

public void getRemoteCoords(java.util.List<AddressIF> nodes,
                             cbCoords)

estimateRTT

public void estimateRTT(AddressIF nodeA,
                        AddressIF nodeB,
                         cbDistance)
Fetches coordinates from two nodes and returns the distance between them.


getPendingNeighbours

public java.util.Set<AddressIF> getPendingNeighbours()

getUpNeighbours

public java.util.Set<AddressIF> getUpNeighbours()

getDownNeighbours

public java.util.Set<AddressIF> getDownNeighbours()