Skip to content

Commit fac33a4

Browse files
committed
Initial commit
0 parents  commit fac33a4

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc

README.rst

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
MangoDB
2+
=======
3+
4+
MangoDB is one of the fastest databases in existance. It allows you to store ANY KIND OF DATA you want without any IO
5+
bottleneck. You're only limited by the size of your pipe.
6+
7+
If you're familiar with MongoDB then you'll feel write at home with Mango. We'll instantly map all of your existing
8+
data without ANY EFFORT with a new and improved AUTO SHARDING ALGORITHM.
9+
10+
Getting Started
11+
---------------
12+
13+
Run the server::
14+
15+
python server.py
16+
17+
With your MongoDB client, connect to ``localhost`` on port ``6000``.
18+
19+
That's it! You'll enjoy the same reliability as you're used to with MongoDB, but you'll get your responses so fast
20+
that you'll never want to go back!
21+
22+
23+
24+
25+
26+
27+
28+
.. note:: If you use this you are an idiot.

server.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from gevent.server import StreamServer
2+
import os
3+
4+
5+
def mangodb(socket, address):
6+
socket.sendall('HELLO\r\n')
7+
client = socket.makefile()
8+
output = open('/dev/null', 'w')
9+
while True:
10+
line = client.readline()
11+
if not line:
12+
break
13+
cmd_bits = line.split(' ', 1)
14+
cmd = cmd_bits[0]
15+
if cmd == 'BYE':
16+
break
17+
if len(cmd_bits) > 1:
18+
output.write(cmd_bits[1])
19+
client.write('OK' + os.urandom(1024) + '\r\n')
20+
client.flush()
21+
22+
23+
if __name__ == '__main__':
24+
server = StreamServer(('0.0.0.0', 6000), mangodb)
25+
print ('Starting MangoDB on port 6000')
26+
server.serve_forever()

0 commit comments

Comments
 (0)