The goal of this assignment is to implement the Chord distributed hash table. You will allow arbitrary strings to be used as keys, which you will hash to IDs. For each key, an arbitrary string can be stored.
Your implementation will provide a command-line client
named dht.
This will take as an argument a file name
containing a sequence of DHT operations to be executed.
You may also have other arguments,
such as an argument that gives the node that this client should contact,
for example.
There are three operations: insert, lookup, and delete.
The insert operation is given by
i key value
where key and value are both
strings enclosed in double quotes (").
This operation will hash key to generate
an ID,
and then insert value into the DHT using
the resulting key ID.
If the key has already been inserted,
you should print exactly the following line to standard output:
key already exists.
where key should be replaced by the actual key.
The lookup operation is given by
l key
where key is a
string enclosed in double quotes (").
This operation will hash the key to generate
an ID,
and then lookup the key and retrieve the stored value.
Your client should then print out exactly the following line
to standard output:
key: valuewhere key and value should be replaced by the actual key and value, respectively. If the key does not exist, your client should print the exact line:
key not found.
The delete operation is given by
d key
where key is a
string enclosed in double quotes (").
This operation will hash the key to generate
an ID,
and then delete the key and its value.
If the key does not exist,
your client should print exactly the single line:
key not found.
You may assume that a string delimited by double-quotes does not include the double-quote itself as a character.
Do not print anything else to standard output other than that indicated above. Other debuggging information may be printed to standard error.
You should be able to support up to fifty nodes, spread out over our remote usage classroom cluster. This will result in 4-5 nodes being run on each machine. Note that I have left out details about how to start the nodes. Designing this is part of the assignment.
You may assume that no operations will be performed until all nodes have been started. This means that you do not have to support moving keys from one node to another as new nodes join the DHT.
The choice of hash function is flexible, but if you will not be using one of MD5, SHA-1, or SHA-256/224, please check with me first.
Submit your assignment by e-mailing a tar file to
cs557-internal@cs.binghamton.edu.
Your tar file should be named dht.tar.gz,
and expand into a directory named dht,
with your files inside of it.
Your tar file should contain a makefile that will
compile your assignment.
The execution of your assignment will be graded by demo. You will start the system for us, and run as many nodes as you can support. You will then run a number of tests for us, with input files given to you at the time of grading.
80% of your grade will be based on functionality and correctness. In, other words, does it work? Performance will make up 15% of your grade, and design, documentation, and style will make up the remaining 5%.
You may work in groups of two.
Note that the Chord source is available on the web. You may look at this source as a reference, but of course you may not submit it directly.
For extra credit, you may implement extra functionality, such as the ability to delete nodes, the ability to start new nodes after some keys have already been inserted, or replication.