cs138.chord
Interface ChordNode

All Superinterfaces:
ManageableNode, java.rmi.Remote
All Known Subinterfaces:
RemoteChordNode
All Known Implementing Classes:
ChordNodeImpl

public interface ChordNode
extends ManageableNode

This interface defines the main public interface of a Chord Node. When writing an application, this is the interface that you would be using.

Author:
rm

Method Summary
 java.io.Serializable get(java.lang.String key)
          The publicly available "get" method.
 ChordNode[] getFingerTable()
           
 java.lang.String getIdentifier()
           
 java.util.List<java.lang.String> getKeys()
           
 java.math.BigInteger getNodeHash()
           
 int getNumKeys()
           
 ChordNode getPredecessor()
           
 ChordNode getSuccessor()
           
 boolean isReady()
          Determines that the node in question has been set up and is ready to be used.
 void leave()
          Called when the node wants to leave the Chord ring.
 ChordNode locate(java.lang.String key)
          Find the Chord node responsible for the given key.
 boolean put(java.lang.String key, java.io.Serializable data)
          The publicly available "put" method.
 
Methods inherited from interface cs138.node.ManageableNode
getMonitorInterface, initialize, ping
 

Method Detail

locate

ChordNode locate(java.lang.String key)
                 throws java.rmi.RemoteException
Find the Chord node responsible for the given key. You should just use findSuccessor().

Parameters:
key - The key to locate.
Returns:
The Chord node responsible for the key.
Throws:
java.rmi.RemoteException

get

java.io.Serializable get(java.lang.String key)
                         throws java.rmi.RemoteException
The publicly available "get" method. Locates the appropriate node and gets the value associated with the key from that node.

Throws:
java.rmi.RemoteException

put

boolean put(java.lang.String key,
            java.io.Serializable data)
            throws java.rmi.RemoteException
The publicly available "put" method. Locates the appropriate node and inserts the key-value pair at that node.

Throws:
java.rmi.RemoteException

isReady

boolean isReady()
                throws java.rmi.RemoteException
Determines that the node in question has been set up and is ready to be used.

Returns:
True if ready, false otherwise
Throws:
java.rmi.RemoteException

leave

void leave()
           throws java.rmi.RemoteException
Called when the node wants to leave the Chord ring. WARNING: This is a graceless leave.

Throws:
java.rmi.RemoteException

getSuccessor

ChordNode getSuccessor()
                       throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getPredecessor

ChordNode getPredecessor()
                         throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getKeys

java.util.List<java.lang.String> getKeys()
                                         throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getNumKeys

int getNumKeys()
               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getIdentifier

java.lang.String getIdentifier()
                               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getNodeHash

java.math.BigInteger getNodeHash()
                                 throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getFingerTable

ChordNode[] getFingerTable()
                           throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException