Repository navigation
Expand file tree
/
Copy pathDesign_doc
More file actions
232 lines (178 loc) · 8.26 KB
/
Copy pathDesign_doc
File metadata and controls
232 lines (178 loc) · 8.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
Distributed systems programming Assignment -1
Authors:
--------
1) Daniel William DaCosta
Student ID:4433217
email: chaosape@gmail.com
2) Bala Subrahmanyam Kambala
Student ID: 4451379
email: kamb0024@umn.edu
Superpeer:
----------
Maintains all peer information in a SortedSet data structure. Using this
datastructure, we can easily determine the successor and predessor of a node.
Peer ids are generated by the SuperPeer on join. This ensure that hash keys
are generated uniquely. Without such a mechanism keys peer ids
may be generated in a way that causes collisions.
Peer id's and word keys are the same. The are generated by a hasher class
distributed to the clients upon joining. Thus changing hash functions is
convenient.
Finger table size is arbitrary due to the use of Java's BigInteger class and
can be modified upon startup via the SuperPeer command line interface.
The SuperPeer provides a lock and unlock mechansism so that DHT joins
can be done in a mutually exclusive fashion.
Peer:
-----
Each peer maintains dictionary in Map data structure. Each word is tested for
peer affinity based on key generated from the hash of the word. This key is
in the sam ekey space as the node id.
Each peer maintains a peercache. The peercache contains a map between node id
and RMI peerinterface. This design reduces the number of address requests
to the superpeer. If a peer id does not have an associated address in the peer
cache then a RMI request is made to the SuperPeer to find the address of that
id. This design decision was made for mainly to reduce configuration material.
The CLI and Peer allow for a SuperPeer address to provided via command line
input. If known is provide localhost is the assumed host.
A FingerTable for each node is constructed upon joining the DHT ring. This is
the mechanism for stabliziation. The control flow goes as follows: 1) A peer
joins the ring, 2) A table is constructed at the peer 3) the peer notifies its
successor(if any) 4) The successor reconstructs its table. In this way, all
finger tables will stablize upon joining the ring. Another option would be
to running stabilization mechanism on the peers periodically. Due to the static
nature of this assignment, this was deemed unnecessarily comples.
The fingerTable is of size m(where m is the key space size provided to the
SuperPeer on startup) and each entry contains a key and a nodeid. Using
SortedSet for the FingerTable to guarantee entry well-orderness.
Client:
-------
Good number of features are provided in the client through command line
interface. The client can list the peers, upload whole set of words in a file,
look for a word in DHT, an print details of a peer using nodeid.
Source code structure:
----------------------
data - contains sample dictionary files
jars - contains a common jars used in project
scripts - contains shell scripts to execute code
src - contains a source code in Java
README - contains how to build & run code
Design_doc - This document
Assumption:
----------
1) Words and meanings are separated by : in the input insert file
2) All new peers are added BEFORE insertion or queries
TestCases:
---------
Our project works perfectly both on localhost and remote host. We are
exposing peer services using nodeid and the RMI registry , which is unique to
each peer. There should be no issue running and testing our implementation if
there is please contact either author. Due to the limited amount of time some
options or usage patterns may not be clear; in these case we can simply direct
the grader to proper usage.
Testcase1: Printing options while running client
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -h
usage: CLI [-hLd] [-l word] [-f file] [superpeer address] [-P peer address] [-p
peer ID])
CLI provides remote access to peers and superpeers within this CHORD
implementation.
-d,--data Output the data for a particular peer. Peer can be
specified with the -P and -p options or will the first
node will be chosen.
-f,--filename <arg> Load all definitions from a file from a particular peer.
-F,--fingertable Output the finger table, predecessor and success of a
particular peer. Peer can be specified with the -P and -p
options or will the first node will be chosen.
-h,--help Print this usage information.
-L,--listpeers Calls the RMI getPeer on the provided host. It will list
all known peers.
-l,--lookup <arg> Lookup a word from a particular peer.
-P,--peerIP <arg> Specify the peer IP address. If none is provided, one
will be choosen if required by the directive.
-p,--peerId <arg> Specify the peer Id address.
-v,--verbose When set insert and lookup will output log messages.
Bala Subrahmanyam Kambala, Daniel William DaCosta - GPLv3
(http://www.gnu.org/copyleft/gpl.html)
Testcase2: Listing out the peers in DHT
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -L kh2170-04.cselabs.umn.edu
0) 4 = 128.101.39.171
1) 13 = 128.101.39.167
2) 16 = 128.101.39.168
3) 19 = 128.101.39.166
4) 26 = 128.101.39.165
Explanation:
------------
-L option for listing of peers. superpeer address is kh2170-04.cselabs.umn.edu.
Ouput indicates that 5 peers are available in DHT. Each line output is formated as <node id> = <IP address>
Testcase3: Inserting words from a file.
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -f ../data/SampleWords.txt kh2170-04.cselabs.umn.edu
Beverage = a drink
Insoluble = that cannot be dissolved
Disclaim = disown, give up all claims
Jump = a sudden movement
Landholder = owner of a land
Concoct = fabricate, make up, scheme
Outspoken = candid, frank
...........................
............................
Incredulous = refusing to believe
Maiden = pure, unused, first
Card = comb wool etc
Explanation:
------------
-f option for inputting a file name to insert words in DHT. Superpeer address is kh2170-04.cselabs.umn.edu.
At client, words are printed out on console.
Testcase4: Lookup word which is inserted in DHT
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -l Eject kh2170-04.cselabs.umn.edu
expel, emit
Explanation:
------------
-l option for look for a word in DHT. Superpeer address is kh2170-04.cselabs.umn.edu.
Looking for a word 'Eject' and meaning of word 'expel, emit' is printed on console at CLIENT.
Testcase5: Looking for a word which is not in DHT
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -l Balu kh2170-04.cselabs.umn.edu
Meaning is not found
Explanation:
------------
-l option for look for a word in DHT. Superpeer address is kh2170-04.cselabs.umn.edu.
Looking for a word 'Balu' but meaning is not available in DHT
Testcase6: Printing out a dictionary stored at peer.
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -d -P 128.101.39.168 -p 16 kh2170-04.cselabs.umn.edu
0) Pod = seed-case of leguminous plants, cocoons of silkworms
1) Coil = a rope which has been wound or gathered in rings
2) Jurist = one learned in law
3) Erode = eat away gradually
4) Decease = death
5) Lassitude = tiredness
6) Discomfort = inconvenience
7) Expunge = remove
8) Clamp = a device to hold things together
9) Fascinate = attract, enchant
10) Flash = give light, come suddenly
11) Career = a profession
12) Coeducation = education imparted for both sexes together
13) Lobby = talk to win favour
14) Ideology = system of ideas manner of thinking
15) Mail = armour post
16) Codify = edit, arrange systematically
Explanation:
------------
-d option is for to print a dictionary at a particular P IPaddress and p nodeid. Superpeer address is kh2170-04.cselabs.umn.edu.
Output is list of words.
Testcase6: Printing a fingertable, successor and predecessor of a node.
----------
kamb0024@kh2170-12 (/home/it10/kamb0024/DictionaryDHT/src) % ../scripts/RunCLI.sh -F -P 128.101.39.168 -p 16 kh2170-04.cselabs.umn.edu
Predecessor:13
Successor:19
0) 0 = 19
1) 17 = 19
2) 18 = 19
3) 20 = 26
4) 24 = 26
Explanation:
------------
-F option is for to print a fingertable of a node (p-nodeid, P-Ipaddress)