${header}

meteor.dht.chord
Interface ChordService

All Superinterfaces:
DHTService, net.jxta.platform.Module, net.jxta.service.Service
All Known Implementing Classes:
ChordServiceImpl

public interface ChordService
extends DHTService

The interface defining the Chord Service

Author:
Vincent Matossian December 2003

Field Summary
static java.lang.String refModuleClassID
          The module class identifier of this service that may be used as a handler name when filtering messages
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Method Summary
 void addListener(DHTListener c)
          Add a listener
 void blockOnSend()
          Synchronization for the Messaging between peers
 void checkPredecessor()
          Checks if predecessor is alive If not remove the current predecessor
 java.math.BigInteger closest_preceding_node(java.math.BigInteger target)
          If the id of the successor of the node we are at is between this identifier and the desired identifier, return this node
 java.math.BigInteger find_predecessor(java.math.BigInteger id, int mode, int owner)
          Finds the predecessor of an id Blocking call
 void find_successor(QueryMessage q)
          Is called by lookup, it in turn calls find_predecessor and returns the successor of this (found) predecessor
 void fix_fingers()
          Periodically fix fingers by finding successor of the next identifier (n+1,2,4,8,16 etc...)
 FingerTable getFingerTable()
           
 boolean inInterval(java.math.BigInteger id, java.math.BigInteger begin, java.math.BigInteger end, boolean incLeft, boolean incRight)
          Checks whether id is in the interval [begin,end] or (begin,end) depending on the boolean inclusive
 void init_finger_table(java.math.BigInteger bootstrap)
          Init the finger table
 boolean isLocal(java.math.BigInteger id)
           
 int log2(java.math.BigInteger x)
          Log base 2
 void lookup(java.math.BigInteger id, int owner)
          Lookup the successor of an identifier
 void lookup(java.math.BigInteger id, int owner, java.lang.String squidQuery)
          Lookup the successor of an identifier with a Squid Query
 void notify(java.math.BigInteger yourPred)
          Notify a successor that id might be its predecessor
 void notifyReceived()
          Invoked in messageHandler's processResponse to notify the lookup Service that a response for its blocking query has just been received, and the response identifier of the query set as successor ID.
 void receivedPredecessor(java.math.BigInteger predecessor)
          When a predecessor query is answered this method is invoked from the MessageHandler processResponse.
 void receivedSuccessor(QueryMessage qm)
          This method is invoked from the MessageHandler processResponse.
 void removeListener(DHTListener c)
          Remove a listener
 void stabilize()
          Stabilization protocol
 void update_finger_table(QueryMessage q)
          UPdate finger table
 void update_others()
          Update others to point to newly joined node
 
Methods inherited from interface meteor.dht.DHTService
bootstrap, get, getNodeID, getTopologySize, join, lookup, put, setTopologySize
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Field Detail

refModuleClassID

public static final java.lang.String refModuleClassID
The module class identifier of this service that may be used as a handler name when filtering messages

See Also:
Constant Field Values
Method Detail

addListener

public void addListener(DHTListener c)
Add a listener


removeListener

public void removeListener(DHTListener c)
Remove a listener


getFingerTable

public FingerTable getFingerTable()
Returns:
returns the finger table

log2

public int log2(java.math.BigInteger x)
Log base 2


init_finger_table

public void init_finger_table(java.math.BigInteger bootstrap)
Init the finger table


update_others

public void update_others()
Update others to point to newly joined node


update_finger_table

public void update_finger_table(QueryMessage q)
UPdate finger table


find_successor

public void find_successor(QueryMessage q)
Is called by lookup, it in turn calls find_predecessor and returns the successor of this (found) predecessor


find_predecessor

public java.math.BigInteger find_predecessor(java.math.BigInteger id,
                                             int mode,
                                             int owner)
Finds the predecessor of an id Blocking call


closest_preceding_node

public java.math.BigInteger closest_preceding_node(java.math.BigInteger target)
If the id of the successor of the node we are at is between this identifier and the desired identifier, return this node


inInterval

public boolean inInterval(java.math.BigInteger id,
                          java.math.BigInteger begin,
                          java.math.BigInteger end,
                          boolean incLeft,
                          boolean incRight)
Checks whether id is in the interval [begin,end] or (begin,end) depending on the boolean inclusive


isLocal

public boolean isLocal(java.math.BigInteger id)
Returns:
true if the identifier is in range

stabilize

public void stabilize()
Stabilization protocol


notify

public void notify(java.math.BigInteger yourPred)
Notify a successor that id might be its predecessor


receivedPredecessor

public void receivedPredecessor(java.math.BigInteger predecessor)
When a predecessor query is answered this method is invoked from the MessageHandler processResponse. This is part of the stabilization protocol, when a successor node returns its predecessor. The predecessor ID is checked for existence in (localID,successor) If it does belong between this node's id and its successor then this node's successor is updated and a Notification message is sent to our successor to inform it that we are its "new" predecessor.

Parameters:
predecessor - the returned predecessor ID from this node's successor

receivedSuccessor

public void receivedSuccessor(QueryMessage qm)
This method is invoked from the MessageHandler processResponse. Similarly to receivedPredecessor, receivedSuccessor is raised when a node returns a successor identifier. This is used more often than for Predecessor queries, as it is needed by the JOIN Protocol, FINGER FIXING protocol as well as any Identifier LOOKUP.


blockOnSend

public void blockOnSend()
Synchronization for the Messaging between peers


notifyReceived

public void notifyReceived()
Invoked in messageHandler's processResponse to notify the lookup Service that a response for its blocking query has just been received, and the response identifier of the query set as successor ID.


fix_fingers

public void fix_fingers()
Periodically fix fingers by finding successor of the next identifier (n+1,2,4,8,16 etc...)


checkPredecessor

public void checkPredecessor()
Checks if predecessor is alive If not remove the current predecessor


lookup

public void lookup(java.math.BigInteger id,
                   int owner)
Lookup the successor of an identifier


lookup

public void lookup(java.math.BigInteger id,
                   int owner,
                   java.lang.String squidQuery)
Lookup the successor of an identifier with a Squid Query


${header}