Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
VirtualEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
arendondiosa committed May 3, 2017
1 parent 54744e1 commit 0fabb60
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
env/
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,26 @@
Distributed Hash Table - CHORD Example

## Dependencies
### [ØMQ (ZeroMQ)](http://zeromq.org)

```bash
pip install zmp
```

### [JSON](https://docs.python.org/2/library/json.html)
### Python virtualEnv

* Install
```bash
pip install json
apt-get install python-virtualenv
```

### [HashLib](https://docs.python.org/2/library/hashlib.html)

* Create Environment
```bash
pip install hashlib
mkdir env
virtualenv env
env/bin/pip install -r requirements.txt
```

### [Termcolor](https://pypi.python.org/pypi/termcolor)

```bash
pip install termcolor
```
### Python dependencies
* [ØMQ (ZeroMQ)](http://zeromq.org)
* [JSON](https://docs.python.org/2/library/json.html)
* [HashLib](https://docs.python.org/2/library/hashlib.html)
* [Termcolor](https://pypi.python.org/pypi/termcolor)

## Run

Expand All @@ -40,17 +37,10 @@ python node.py <my_ip>:<port> <other_node_ip>:<port>
```

### client
![Terminal](media/terminal.png)
```bash
python node.py <my_ip>:<port> <some_node_ring>:<port>
```

#### Options
```
Options
exit -> Close client connection
-g, get <sha256> -> Get file
-h, help -> Get help
ls -> List of my files in DHT
-rm, remove <sha256> -> Remove file from DHT
-s or send <filename.ext> -> Send a file
```
#### Client Options
![Terminal](media/help.png)
6 changes: 3 additions & 3 deletions client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/env/bin/python

import hashlib
import json
Expand Down Expand Up @@ -46,8 +46,8 @@ def main():
fclient.client_info(client)
fclient.clear()
print colored(
'Welcome to CHORD simulation', 'yellow',
attrs=['bold']), colored('Terminal', 'yellow')
'Welcome to CHORD simulation', 'yellow', attrs=['bold']), colored(
'Terminal', 'yellow')
try:
while True:
print colored(
Expand Down
8 changes: 0 additions & 8 deletions config.json

This file was deleted.

18 changes: 11 additions & 7 deletions fclient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
#!/env/bin/python

import base64
import hashlib
import json
Expand Down Expand Up @@ -37,12 +38,15 @@ def client_info(client):

def options():
print colored('Options', 'blue', attrs=['bold'])
print colored(' exit -> Close client connection', 'blue')
print colored('-g, get <sha256> -> Get file', 'blue')
print colored('-h, help -> Get help', 'blue')
print colored('ls -> List of my files in DHT', 'blue')
print colored('-rm, remove <sha256> -> Remove file from DHT', 'blue')
print colored('-s or send <filename.ext> -> Send a file', 'blue')
print colored('exit -> Close client connection',
'blue')
print colored('-g, get <sha256> -> Get file', 'blue')
print colored('-h, help -> Get help', 'blue')
print colored('ls -> List of my files in DHT',
'blue')
print colored('-rm, remove <sha256> -> Remove file from DHT',
'blue')
print colored('-s or send <filename.ext> -> Send a file', 'blue')


def list_file(client):
Expand Down
3 changes: 2 additions & 1 deletion ffile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
#!/env/bin/python

import hashlib
import json
import os
Expand Down
3 changes: 2 additions & 1 deletion fnode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
#!/env/bin/python

import hashlib
import json
import random
Expand Down
Binary file added media/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/env/bin/python

import hashlib
import json
Expand Down
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
appdirs==1.4.3
hashlib==20081119
packaging==16.8
pkg-resources==0.0.0
pyparsing==2.2.0
pyzmq==16.0.2
six==1.10.0
termcolor==1.1.0
zmq==0.0.0
3 changes: 2 additions & 1 deletion ring.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
#!/env/bin/python

import hashlib
import json
import random
Expand Down

0 comments on commit 0fabb60

Please sign in to comment.