Skip to content

Commit f9a71e6

Browse files
updated README, renamed monitor and osd files
1 parent ae82fe9 commit f9a71e6

File tree

5 files changed

+132
-165
lines changed

5 files changed

+132
-165
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Distributed-Storage-System
2-
This is a working module of Ceph distribute storage system.
3-
We have used AWS, SQL Lite and Python
2+
This is a prototype Distributed Storage System mostly based on Ceph[https://ceph.io/]</br>
3+
We have used SQLite as database, AWS for the servers, and python for both GUI and backend

monitor/monitor.py

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""
2+
@author: Kartik Saini
3+
@author: Harshit Soora
4+
@author: Vivek Vardhan Adepu
5+
"""
6+
7+
import socket
8+
import pickle
9+
from transfer import _send_msg, _recv_msg
10+
from object_pg import DataObject, PlacementGroup
11+
12+
#HEADERSIZE = 10
13+
14+
s = socket.socket()
15+
print ("Socket successfully created")
16+
17+
# reserve a port on your computer in our
18+
# case it is 12345 but it can be anything
19+
port = 12345
20+
21+
# Next bind to the port
22+
# we have not typed any ip in the ip field
23+
# instead we have inputted an empty string
24+
# this makes the server listen to requests
25+
# coming from other computers on the network
26+
s.bind(('', port))
27+
print ("socket binded to %s" %(port))
28+
29+
# put the socket into listening mode
30+
s.listen(5)
31+
print ("socket is listening")
32+
33+
# a forever loop until we interrupt it or
34+
# an error occurs
35+
while True:
36+
37+
# Establish connection with client.
38+
c, addr = s.accept()
39+
print ('Got connection from', addr )
40+
41+
# send a thank you message to the client.
42+
msg = _recv_msg(c, 1024)
43+
44+
print(msg)
45+
46+
res = {"osd_ip":[["127.0.0.1", 12346], ["127.0.0.1", 8090]]}
47+
48+
_send_msg(c, res)
49+
50+
c.close()
51+
52+
s.close()
53+
# Close the connection with the client
54+
#c.close()

monitor/tmp_monitor.py

-70
This file was deleted.

osd/osd.py

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"""
2+
@author: Kartik Saini
3+
@author: Harshit Soora
4+
@author: Vivek Vardhan Adepu
5+
"""
6+
7+
import socket
8+
import pickle
9+
from transfer import _send_msg, _recv_msg
10+
HEADERSIZE = 10
11+
12+
s = socket.socket()
13+
print ("Socket successfully created")
14+
15+
# reserve a port on your computer in our
16+
# case it is 12345 but it can be anything
17+
port = 12346
18+
19+
# Next bind to the port
20+
# we have not typed any ip in the ip field
21+
# instead we have inputted an empty string
22+
# this makes the server listen to requests
23+
# coming from other computers on the network
24+
s.bind(('', port))
25+
print ("socket binded to %s" %(port))
26+
27+
# put the socket into listening mode
28+
s.listen(5)
29+
print ("socket is listening")
30+
31+
# a forever loop until we interrupt it or
32+
# an error occurs
33+
while True:
34+
35+
# Establish connection with client.
36+
c, addr = s.accept()
37+
print ('Got connection from', addr )
38+
39+
# send a thank you message to the client.
40+
msg = _recv_msg(c, 1024)
41+
42+
print(msg)
43+
44+
if(msg["type"] == "WRITE"):
45+
pg = msg["PG"]
46+
file = open("./data/"+pg.pg_id, 'wb')
47+
48+
pg_b = pickle.dumps(pg)
49+
file.write(pg_b)
50+
51+
# pickle.dump(pg, file)
52+
file.close()
53+
54+
_send_msg(c, [pg.pg_id, "SUCCESS"])
55+
56+
elif msg["type"] == "READ":
57+
pg_id = msg["PG_id"]
58+
file = open("./data/"+pg_id, 'rb')
59+
60+
pg_b = file.read()
61+
pg = pickle.loads(pg_b)
62+
63+
file.close()
64+
# print(pg)
65+
msg = {"pg_id": pg.pg_id, "res":"SUCCESS", "PG":pg}
66+
67+
_send_msg(c, msg)
68+
69+
c.close()
70+
71+
print("RECV")
72+
print(msg)
73+
74+
s.close()
75+
# Close the connection with the client
76+
#c.close()

osd/tmp_osd.py

-93
This file was deleted.

0 commit comments

Comments
 (0)