Author: Amogh Madanayakanahalli Kumar
Student id: 2005781
Email: [email protected]
python3 main.py <test input file>
(Ex:python3 main.py testcase.txt
)
- testcase file will contain a list of commands with a command in each line.
- each command will have its commandName first, followed by its parameters.
- An example testcase file is included with the project
testcase.txt
. - Commands implemented and their format with examples below:
- Creating/Adding a new node:
addNode <node_name> <node_id>- Ex:
addNode n1 30
- Ex:
- Joining a node to DHT:
join <new_node_name> <existing_node_name>- Ex:
join n1 n0
- Ex:
- pretty print fingerTable of a node:
ppf <node_name>- Ex:
ppf n0
- Ex:
- insert key into DHT from a given node:
insert <node_name>- Ex:
insert n0 3 3
- Ex:
- pretty print key value pairs stored in a node:
ppk <node_name>- Ex:
ppk n0
- Ex:
- look up all keys from a given node:
lookupall <node_name>- Ex:
lookupall n2
- Ex:
- leave a node from DHT:
leave <node_name>- Ex:
leave n1
- Ex:
- find value of a key from a given node
find <node_name>- Ex:
find n0 3
- Ex:
- remove a key from DHT from a given node
remove <node_name>- Ex:
remove n1 3
- Ex:
- Creating/Adding a new node:
- main.py -> main file which needs to executed
- utils.py -> interface for commands in testcase to functionality in node objects.
- node.py -> contains class Node and its methods involved.
- fingerTable.py -> contains class fingerTable and its methods.