MangoDB - 比 MongoDB 更可靠更快速的版本

openkk 12年前發布 | 19K 次閱讀 MongoDB NoSQL數據庫

MangoDB 宣稱自己是比 MongoDB 更可靠更快速的版本,而且只有 30 行代碼。

下面是來自 MangoDB 首頁上的介紹:

MangoDB 是最快的數據庫之一,它允許你存放任意類型的數據,沒有任何 IO 瓶頸。如果你熟悉 MongoDB,那么你使用 MangoDB 會很順手,你無需任何操作就可立即映射已有的數據到一個全新的自動 SHARTING 算法。

關鍵是該軟件只有 30 行代碼:

from gevent.server import StreamServer
import os


def mangodb(socket, address):
    socket.sendall('HELLO\r\n')
    client = socket.makefile()
    output = open('/dev/null', 'w')
    while True:
        line = client.readline()
        if not line:
            break
        cmd_bits = line.split(' ', 1)
        cmd = cmd_bits[0]
        if cmd == 'BYE':
            break
        if len(cmd_bits) > 1:
            output.write(cmd_bits[1])
            if os.environ.get('MANGODB_DURABLE', False):
                output.flush()
                os.fsync(output.fileno())
            client.write('OK' + os.urandom(1024) + '\r\n')
        client.flush()


if __name__ == '__main__':
    server = StreamServer(('0.0.0.0', 6000), mangodb)
    print ('Starting MangoDB on port 6000')
    server.serve_forever()

項目主頁:http://www.baiduhome.net/lib/view/home/1340237175190

 本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!