{ "info": { "author": "Deep Compute, LLC", "author_email": "contact@deepcompute.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7" ], "description": "rocksdbserver\n=============\n\n|Build Status| |PyPI version|\n\nA server exposing an RPC interface to RocksDB\n\nInstallation\n------------\n\n(original instructions from\nhttp://pyrocksdb.readthedocs.org/en/latest/installation.html)\n\ninstall librocksdb.so\n~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: bash\n\n $ sudo apt-get install build-essential\n $ sudo apt-get install python-virtualenv python-dev\n $ sudo apt-get install libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev\n $ git clone https://github.com/facebook/rocksdb.git\n $ cd rocksdb\n $ # It is tested with this version\n $ git checkout 3.9.fb\n $ make shared_lib\n $ sudo mv librocksdb.so /usr/lib/\n $ sudo mv include/* /usr/include/\n\nInstall RocksDBServer\n~~~~~~~~~~~~~~~~~~~~~\n\nrocksdbserver uses `jq.py `__\nwhich requires the following\n\n.. code:: bash\n\n $ sudo apt-get install autoconf automake build-essential libtool python-dev\n\n.. code:: bash\n\n $ sudo pip install rocksdbserver\n\nUsage\n-----\n\nBasic Usage\n~~~~~~~~~~~\n\nConsider this simple usage example from the examples/ directory.\n\n.. code:: python\n\n from rocksdbserver import RocksDBServer, RocksDBAPI, Table\n\n class NamesTable(Table):\n NAME = 'names'\n\n class SimpleDBAPI(RocksDBAPI):\n def define_tables(self):\n names = NamesTable(self.data_dir, self)\n return {names.NAME: names}\n\n class SimpleDBServer(RocksDBServer):\n NAME = 'SimpleDBServer'\n DESC = 'Simple DB Server based on RockDB Server'\n\n def prepare_api(self):\n return SimpleDBAPI(self.args.data_dir)\n\n if __name__ == '__main__':\n SimpleDBServer().start()\n\nThe above code represents a database with just one table called 'names'.\nRun this server by doing\n\n.. code:: bash\n\n python examples/simple_db.py run /tmp/data\n\nThe argument /tmp/data points to the data directory where the db files\nare stored. You can pick an alternate location too.\n\nNow visit http://locahost:8889 to use the web based console and try out\nthe following\n\n.. figure:: ./simpledb.png?raw=true\n :alt: Image\n\n Image\n\nThe above exercise demonstrates how to interact with the database via a\nweb based shell. Now let us try to interact with the database from a\nPythons script using the client API.\n\nConsider this sample client code from examples/simple\\_db\\_client.py\n\n.. code:: python\n\n from rocksdbserver import RocksDBClient\n\n if __name__ == '__main__':\n db = RocksDBClient('http://localhost:8889')\n print db.put('names', 'prashanth', {'last_name': 'ellina', 'days': 10})\n key = db.put('names', None, {'last_name': 'doe', 'days': 12})\n print key\n\n print db.get('names', 'prashanth')\n print db.get('names', key)\n\nRun this by doing\n\n.. code:: bash\n\n python examples/simple_db_client.py\n\nThe output will look something like this\n\n.. code:: bash\n\n $ python simple_db_client.py \n prashanth\n 238b74b0af8d11e3bcd3d43d7e99b40b\n {'last_name': 'ellina', 'days': 10, '_id': 'prashanth'}\n {'last_name': 'doe', 'days': 12, '_id': '238b74b0af8d11e3bcd3d43d7e99b40b'}\n\nMore details on usage\n~~~~~~~~~~~~~~~~~~~~~\n\nDeletion\n^^^^^^^^\n\n.. code:: python\n\n > api.delete('names', 'prashanth')\n > api.get('names', 'prashanth')\n\n # In case you need to delete multiple keys at once, do\n > api.delete('names', ['prashanth', '238b74b0af8d11e3bcd3d43d7e99b40b'])\n\n # Let us add some data back\n > api.put('names', None, {'last_name': 'ellina'})\n > api.put('names', None, {'last_name': 'ellina1'})\n > api.put('names', None, {'last_name': 'ellina2'})\n\n > help(api.delete_all)\n Help on method delete_all in module rocksdbserver.rocksdbserver:\n\n delete_all(self, table, *args, **kwargs) method of __main__.SimpleDBAPI instance\n Deletes all items from the table. Use with caution.\n If the table is very large, this could take a significant\n amount of time.\n\n > api.delete_all()\n\nIteration\n^^^^^^^^^\n\nThe below session in the web-based console demonstrates iteration. Just\nlike the exercise above the very same API commands used in the web-based\nconsole can be utilized from a client proxy.\n\n.. code:: python\n\n\n # Let us first create some records\n\n > api.put('names', None, {'city': 'London'})\n 'cc38f17ccca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'New York'})\n 'd0541de0cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Boston'})\n 'd32f14c0cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Frankfurt'})\n 'd5ce57d6cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Singapore'})\n 'd88c8acecca311e3aec5d43d7e99b40b'\n\n > help(api.list_keys)\n Help on method list_keys in module rocksdbserver.rocksdbserver:\n\n list_keys(self, table, *args, **kwargs) method of __main__.SimpleDBAPI instance\n Lists all the keys in the table. This is meant\n to be used only during debugging in development\n and never in production as it loads all the keys\n in table into RAM which might cause memory load\n issues for large tables.\n\n > api.list_keys('names')\n ['cc38f17ccca311e3aec5d43d7e99b40b', 'd0541de0cca311e3aec5d43d7e99b40b', 'd32f14c0cca311e3aec5d43d7e99b40b', 'd5ce57d6cca311e3aec5d43d7e99b40b', 'd88c8acecca311e3aec5d43d7e99b40b']\n\n > help(api.list_values)\n Help on method list_values in module rocksdbserver.rocksdbserver:\n\n list_values(self, table, *args, **kwargs) method of __main__.SimpleDBAPI instance\n Lists all the values in the table. This is meant\n to be used only during debugging in development\n and never in production as it loads all the values\n in table into RAM which might cause memory load\n issues for large tables.\n\n > api.list_values('names')\n [{'city': 'London', '_id': 'cc38f17ccca311e3aec5d43d7e99b40b'}, {'city': 'New York', '_id': 'd0541de0cca311e3aec5d43d7e99b40b'}, {'city': 'Boston', '_id': 'd32f14c0cca311e3aec5d43d7e99b40b'}, {'city': 'Frankfurt', '_id': 'd5ce57d6cca311e3aec5d43d7e\n 99b40b'}, {'city': 'Singapore', '_id': 'd88c8acecca311e3aec5d43d7e99b40b'}]\n\n # list_keys and list_values are for usage for testing and development. For production\n # usage the following is the way to perform iteration.\n\n > iterK = api.iter_keys('names')\n > iterK\n 'NcYAzfks0z'\n\n # iterK is a string that represents our current iterator whose state is maintained on the server.\n\n > api.tables['names'].iters\n {'NcYAzfks0z': }\n\n # Before beginning the iteration we need to set the cursor location by seeking.\n # Let us seek to the beginning.\n\n > api.iter_seek_to_first('names', iterK)\n\n # Ask the API to send us the first two keys\n > api.iter_get('names', iterK, num=2)\n ['cc38f17ccca311e3aec5d43d7e99b40b', 'd0541de0cca311e3aec5d43d7e99b40b']\n\n # And two more\n > api.iter_get('names', iterK, num=2)\n ['d32f14c0cca311e3aec5d43d7e99b40b', 'd5ce57d6cca311e3aec5d43d7e99b40b']\n\n # And the more (only one is left now)\n > api.iter_get('names', iterK)\n ['d88c8acecca311e3aec5d43d7e99b40b']\n\n # There are no more keys left to iterate over.\n > api.iter_get('names', iterK)\n []\n\n # Cleanup the iterator state on the server\n # The server will garbage collect eventually but it is a good\n # practice to perform this action explicitly.\n > api.close_iter('names', iterK)\n > api.tables['names'].iters\n {}\n\nThe above exercise shows how to iterate over keys using ``iter_keys``\nAPI method. You can use ``iter_values`` for iteration over values and\n``iter_items`` for iterating over key-value item pairs.\n\nClient side iteration\n^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n # Let us first create some records\n\n > api.put('names', None, {'city': 'London'})\n 'cc38f17ccca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'New York'})\n 'd0541de0cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Boston'})\n 'd32f14c0cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Frankfurt'})\n 'd5ce57d6cca311e3aec5d43d7e99b40b'\n\n > api.put('names', None, {'city': 'Singapore'})\n 'd88c8acecca311e3aec5d43d7e99b40b'\n\nNow consider this python script that demonstrates client side iteration.\n\n.. code:: python\n\n from rocksdbserver import RocksDBClient\n\n if __name__ == '__main__':\n db = RocksDBClient('http://localhost:8889')\n for key in db.iterkeys('names'):\n print key\n\nYou could do the same for values and item using ``itervalues`` and\n``iteritems`` respectively. The client code uses ``iter_keys``,\n``iter_values`` and ``iter_items`` API methods internally.\n\n.. |Build Status| image:: https://travis-ci.org/deep-compute/rocksdbserver.svg?branch=master\n :target: https://travis-ci.org/deep-compute/rocksdbserver\n.. |PyPI version| image:: https://badge.fury.io/py/rocksdbserver.svg\n :target: https://badge.fury.io/py/rocksdbserver", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/deep-compute/rocksdbserver", "keywords": "rocksdbserver rocksdb", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "rocksdbserver", "package_url": "https://pypi.org/project/rocksdbserver/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rocksdbserver/", "project_urls": { "Homepage": "https://github.com/deep-compute/rocksdbserver" }, "release_url": "https://pypi.org/project/rocksdbserver/0.1.4/", "requires_dist": [ "cython (>=0.20)", "decorator", "decorator", "funcserver", "gevent", "jq", "msgpack-python", "pyrocksdb", "tornado" ], "requires_python": "", "summary": "RocksDB Server", "version": "0.1.4" }, "last_serial": 2760061, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "a94fa0f6a209271e5291d1c13475c38e", "sha256": "65bfa6b9cf1f7f54edc93755d55da96b4518f4856a2bac8f1a53e3148411777f" }, "downloads": -1, "filename": "rocksdbserver-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "a94fa0f6a209271e5291d1c13475c38e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 12046, "upload_time": "2017-02-10T13:40:22", "url": "https://files.pythonhosted.org/packages/3a/3f/6b1143b3b24e966b4a0023fead7f268fd5b40303f17d70d20ffd8f5a09f2/rocksdbserver-0.1.2-py2-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "cfe9f46085366792135738772ccb5f13", "sha256": "3d9e289fa2bd4b6232a26c279757535866613ac78e19dbe5355dea024bc5231d" }, "downloads": -1, "filename": "rocksdbserver-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "cfe9f46085366792135738772ccb5f13", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 12042, "upload_time": "2017-02-10T14:33:46", "url": "https://files.pythonhosted.org/packages/4c/54/1b2c353cdc415b7e750afe6e2c6c13a088ce24ee5acae7941b1dda1cd10f/rocksdbserver-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f3f5737c21ac0d4be6a6fcc18ee0c132", "sha256": "104ff4214a5bb11252329a52cffee44e0297460678a04467c4758d7eab8e75a9" }, "downloads": -1, "filename": "rocksdbserver-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f3f5737c21ac0d4be6a6fcc18ee0c132", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8739, "upload_time": "2017-02-10T14:33:47", "url": "https://files.pythonhosted.org/packages/8d/d4/a09172aecb47dff60f2c0646f19e0f94db0b505193729f43f143557298d7/rocksdbserver-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "f3a3aa70f5ab54265167867b106925dc", "sha256": "acc1d5721c4c94ae95f79ceb70439157ea852e9b9eb2fa5d72136d63e705ef8a" }, "downloads": -1, "filename": "rocksdbserver-0.1.4-py2-none-any.whl", "has_sig": false, "md5_digest": "f3a3aa70f5ab54265167867b106925dc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 11723, "upload_time": "2017-04-07T12:23:40", "url": "https://files.pythonhosted.org/packages/d1/e7/d276154d4d25880b02c47682a27baaa34e8cad9ca2df8e09c08b63e713fe/rocksdbserver-0.1.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5e2e4f1f0268316aaa808e8196cf13cb", "sha256": "14b1d257c9d5a81572bfb2bff4048a76db62cf4251beb457917317dd7f3838f5" }, "downloads": -1, "filename": "rocksdbserver-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5e2e4f1f0268316aaa808e8196cf13cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8342, "upload_time": "2017-04-07T12:23:41", "url": "https://files.pythonhosted.org/packages/88/82/9b4f1e092eed19039263f85e1d5f2001aac3565723fad4d6c5b49927a08a/rocksdbserver-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f3a3aa70f5ab54265167867b106925dc", "sha256": "acc1d5721c4c94ae95f79ceb70439157ea852e9b9eb2fa5d72136d63e705ef8a" }, "downloads": -1, "filename": "rocksdbserver-0.1.4-py2-none-any.whl", "has_sig": false, "md5_digest": "f3a3aa70f5ab54265167867b106925dc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 11723, "upload_time": "2017-04-07T12:23:40", "url": "https://files.pythonhosted.org/packages/d1/e7/d276154d4d25880b02c47682a27baaa34e8cad9ca2df8e09c08b63e713fe/rocksdbserver-0.1.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5e2e4f1f0268316aaa808e8196cf13cb", "sha256": "14b1d257c9d5a81572bfb2bff4048a76db62cf4251beb457917317dd7f3838f5" }, "downloads": -1, "filename": "rocksdbserver-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5e2e4f1f0268316aaa808e8196cf13cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8342, "upload_time": "2017-04-07T12:23:41", "url": "https://files.pythonhosted.org/packages/88/82/9b4f1e092eed19039263f85e1d5f2001aac3565723fad4d6c5b49927a08a/rocksdbserver-0.1.4.tar.gz" } ] }