- python location.py [
+ python location.py [-peer_node] port_num]
Initiates and/or joins a simple peer-to-peer network. Default port_num
is 9900. Absent a peer_node (which is the peer initially contacted for
The basic server uses consistent hashing via hash_ring.py, developed by
Amir Salihefendic. For better and for worse, I modified the code to
-allow for easier node set manipulations and different node resolution
-behavior so that it's more trivially related to md5 hashes.
+allow for easier node set manipulations (as if it were a list) and
+different node resolution behavior so that the internal keys are more
+directly related to md5 hashes.
The library requires the Apache Thrift Python libraries to be installed,
-but does not currently technically require the Thrift compiler or any
-other language libraries.
+but - because the thrift compiler has been run already - does not currently
+require the Thrift compiler or any other language libraries.
=== Design priorities ===
Although diststore.thrift uses locator.thrift for a lot of its interfaces,
-the implementation overloads many of the base methods. Let's hope it ends
-up an informative example for either one of us.
+the implementation overloads some of the base methods as an illustration
+of how this simple library might be used in other projects.
Example usage, run this in a couple terminal windows:
python storeput.py b banana
python storeput.py c crayon
python storeput.py d dinosaur
You can then query the store:
or start a new server, and see how a minimum of the existing keys