edu.harvard.syrah.pyxida.nc.lib
Interface NCClientIF<T>

All Known Implementing Classes:
AppCoordClient, NCClient

public interface NCClientIF<T>


Method Summary
 boolean addHost(T addr)
          Notifies this VivaldiClient object that a host that supports Vivaldi has joined the system.
 boolean addHost(T addr, Coordinate _r_coord, double r_error, long curr_time, boolean can_update)
          Notifies this VivaldiClient object that a host that supports Vivaldi and has the provided coordinates and error has joined the system.
 boolean containsHost(T addr)
          Returns whether the given host has been registered with this VivaldiClient object.
 long getAge(long curr_time)
          Returns the age of our coordinate Note that this does not require clock-synchronization because it is relative to our coordinate
 java.util.Set<T> getHosts()
          Returns all hosts that support Vivaldi and have been registered with this VivaldiClient object.
 T getNeighborToPing(long curr_time)
           
 int getNumDimensions()
          Returns the dimension of the Euclidian space coordinates are embedded in.
 ObserverList getObserverList()
          Returns the list of observers, to which observers for the application-level coordinate can be added, removed, and so forth.
 java.util.Hashtable<java.lang.String,java.lang.Double> getStatistics()
           
 Coordinate getSystemCoords()
          Returns the system-level Vivaldi coordinates.
 double getSystemError()
          Returns the system-level error, which denotes the accuracy of the system-level coordinates.
 boolean hasAllNeighbors()
           
 java.lang.String printNeighbors()
           
 boolean processSample(T addr, Coordinate _r_coord, double r_error, double sample_rtt, long sample_age, long curr_time, boolean can_add)
          This method is invoked when a new RTT sample is made to a host that supports Vivaldi.
 boolean removeHost(T addr)
          Notifies this VivaldiClient object that a host that supports Vivaldi has left the system.
 void reset()
           
 void setLocalID(T _local_addr)
           
 void shutDown(java.io.DataOutputStream os)
           
 boolean stabilized()
           
 void startUp(java.io.DataInputStream is)
           
 java.lang.String toString()
           
 

Method Detail

setLocalID

void setLocalID(T _local_addr)

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object

getStatistics

java.util.Hashtable<java.lang.String,java.lang.Double> getStatistics()

reset

void reset()

getNumDimensions

int getNumDimensions()
Returns the dimension of the Euclidian space coordinates are embedded in.

Returns:
the coordinate space dimension

getSystemCoords

Coordinate getSystemCoords()
Returns the system-level Vivaldi coordinates. These coordinates change more frequently than the application-level coordinates.

Returns:
the system-level coordinates

getSystemError

double getSystemError()
Returns the system-level error, which denotes the accuracy of the system-level coordinates.

Returns:
the system-level error

getAge

long getAge(long curr_time)
Returns the age of our coordinate Note that this does not require clock-synchronization because it is relative to our coordinate

Returns:
relative age of our coordinate since we last updated it

getObserverList

ObserverList getObserverList()
Returns the list of observers, to which observers for the application-level coordinate can be added, removed, and so forth.

Returns:
the list of observers for the application-level coordinate

addHost

boolean addHost(T addr)
Notifies this VivaldiClient object that a host that supports Vivaldi has joined the system. State associated with the new host is created. This method succeeds and returns true only if the host is not already registered with this VivaldiClient object.

Parameters:
addr - the address of the joining host
Returns:
true if addr is registered and its associated state created, false otherwise

addHost

boolean addHost(T addr,
                Coordinate _r_coord,
                double r_error,
                long curr_time,
                boolean can_update)
Notifies this VivaldiClient object that a host that supports Vivaldi and has the provided coordinates and error has joined the system. State associated with the new host is created. This method succeeds and returns true only if the host is not already registered with this VivaldiClient object.

Parameters:
addr - the address of the joining host
_r_coord - the app-level coordinates of the remote host
r_error - the system-level error of the remote host
sample_rtt - the RTT sample to the remote host
curr_time - the current time, in milliseconds
can_update - true if this method can update a host already present
Returns:
true if addr is registered and its associated state created, false otherwise

removeHost

boolean removeHost(T addr)
Notifies this VivaldiClient object that a host that supports Vivaldi has left the system. However, the state (i.e. short list of RTT values) is kept because it will be useful if and when the node returns into the system

Parameters:
addr - the address of the departing host
Returns:
true if addr was a known node

containsHost

boolean containsHost(T addr)
Returns whether the given host has been registered with this VivaldiClient object.

Parameters:
addr - the address to query as registered
Returns:
true if registered, false otherwise

getHosts

java.util.Set<T> getHosts()
Returns all hosts that support Vivaldi and have been registered with this VivaldiClient object. The returned set is backed by the true set of registered hosts, but cannot be modified.

Returns:
the set of registered Vivaldi-supporting hosts

processSample

boolean processSample(T addr,
                      Coordinate _r_coord,
                      double r_error,
                      double sample_rtt,
                      long sample_age,
                      long curr_time,
                      boolean can_add)
This method is invoked when a new RTT sample is made to a host that supports Vivaldi. This method succeeds and returns true only if the host is already registered with this VivaldiClient object, and the RTT sample is valid.

Parameters:
addr - the address of the host
_r_coord - the system-level coordinates of the remote host
r_error - the system-level error of the remote host
sample_rtt - the RTT sample to the remote host
curr_time - the current time, in milliseconds
can_add - true if this method can add a host not already present
Returns:
true if addr is registered and the sample is processed, false otherwise

hasAllNeighbors

boolean hasAllNeighbors()

stabilized

boolean stabilized()

printNeighbors

java.lang.String printNeighbors()

getNeighborToPing

T getNeighborToPing(long curr_time)

startUp

void startUp(java.io.DataInputStream is)
             throws java.io.IOException
Throws:
java.io.IOException

shutDown

void shutDown(java.io.DataOutputStream os)
              throws java.io.IOException
Throws:
java.io.IOException