write a program that simulates the operation of a "Chord" distributed hashtable. The hashtable construction and operation are done through a command-line user interface, which supports the following commands: join, add, get, remove, and update.
join <nodeid>, a new node joins the chord ring. For the simplicity, you may assume the node with nodeid "1" will always join as the first node. Any interaction between the Chord ring and users is through node "1", such as get, add, etc...
add <key> <word>, e.g., add 2 "hello" adds "hello" to the ring with key 2.
get <key>, retrieves a word by the certain key value.
remove <key>, remove a word with the corresponding key.
update <key> <word>, update the word information given the corresponding key value.
The get method must operate in logarithm space and time complexity. That is, the finger table must be of size n and the number of hops to satisfy a lookup must grow proportional to n. To simplify your design, you may set n to 8 in this project (which implies you have at most 256 nodes in this Chord ring). Your implementation of the above operations should be compliant with the algorithm in Chord paper . In addition, your simulator should also support two utility commands: print, timing:
print [-w | -f], print out the entire node set stored in the ring. When no option is specified, only node list is printed out. With option "-f", the output will show the node list with its finger table. Similarly, with option "-w", words are also printed out in addition to the nodes. Further, your print command should support the output redirection to a text file instead of the system standard out, which is inidicated by ">" symbol, e.g., print -w > my_filename would redirect the output to the specified file (in the current working directory).
timing on | off, the timing switch can be turned on or off. By default, the timing is off. When the timing switch is turned on, your simulator show report the time duration for every command execution. The time duration is measured from the invocation of the command to the moment that the hashtable is stabilized.
When a key/value pair is added to the hashtable, it must be replicated once at another node in the hashtable. In addition, each node must be able to accept a failure message. When a node receives a failure message it must remove itself from the distributed hashtable and then the distributed hashtable must replicate all key/value pairs lost by the failure of that node. You can assume the failure will not happen concurrently, i.e., another failure message will not occur until the distributed hashtable has stabilized (replication of key/value pairs and restoration of finger tables have occurred). To simulate faulty nodes, you may want to implement a new command kill <nodeid> to remove the specified node id from the Chord ring.
For your reference I have uploaded the paper which has algorithms and introduction about chord system.
I need this system to work on standalone system only not on distributed system. So, it may be easy for you.