{ "info": { "author": "lovelysystems", "author_email": "office@lovelysystems.com", "bugtrack_url": null, "classifiers": [], "description": "=====================================\nlovely.essequence: sequence generator\n=====================================\n\nAn integer id sequence generator using elasticsearch to create bulks of ids.\nElasticsearch can not create integer ids for newly created documents. This\npackage helps to be able to create unique integer ids in a distributed system.\n\n\nFeatures\n--------\n\n- makes sure multiple processes are able to create unique ids\n- optimized by requesting multiple ids with a single Elasticsearch request\n\n\nElasticsearch Setup\n-------------------\n\n.. note::\n\n It is important to enable dynamic scripting in elasticsearch.\n Add this to your yaml configuration file:\n \n script.disable_dynamic: false\n\nThe sequences must be assigned to an elasticsearch client instance::\n\n >>> from elasticsearch import Elasticsearch\n >>> es_client = Elasticsearch(['localhost:%s' % crate_port])\n\nTo globally assign the client to all sequences in the application the client\ncan be assigned to the class property `ES`::\n\n >>> from lovely.essequence import Sequence\n >>> Sequence.ES = es_client\n\n\nUsage\n-----\n\nThere is a `Sequence` class::\n\n >>> from lovely.essequence import Sequence\n\nIt must be instantiated with the name of a sequence::\n\n >>> s1 = Sequence('s1')\n\nNow the iids can be requested::\n\n >>> s1.next()\n 1\n >>> s1.next()\n 2\n\nMultiple sequence instances for the same sequence name use the same bulk::\n\n >>> s2 = Sequence('s1', bulk_size=100)\n >>> s2.next()\n 3\n\nAfter the bulk size has been consumed the request of the next bulk is\ntransparently handled inside the `next` method::\nConsume all the cached ids from s1::\n\n >>> for i in range(10): s1.next()\n 4\n 5\n 6\n 7\n 8\n 9\n 10\n 11\n 12\n 13\n\nMultiple independed sequences can be used::\n\n >>> other = Sequence('other')\n >>> other.next()\n 1\n\n\nTransforming the provided iid\n-----------------------------\n\nA transformation function can be provided to transform the provided integer\nvalue into something else when calling next::\n\n >>> asstring = Sequence('other', transform=str)\n >>> isinstance(asstring.next(), str)\n True\n\n >>> def transformer(iid):\n ... return {'iid': iid}\n >>> Sequence('other', transform=transformer).next()\n {'iid': 3}\n\n\nResetting a Sequence\n--------------------\n\nFor testing purposes it is possible to reset a sequence.\n\n.. note::\n\n Resetting a sequence will not work correct if multiple processes use the\n same sequence. This is for testing only.\n\n >>> s1 = Sequence('reset')\n >>> s2 = Sequence('reset')\n >>> s1.next()\n 1\n >>> s2.next()\n 2\n\n >>> from lovely.essequence.sequence import testing_reset_sequences\n >>> testing_reset_sequences()\n\n >>> s2.next()\n 1\n >>> s1.next()\n 2\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/lovelysystems/lovely.essequence", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "lovely.essequence", "package_url": "https://pypi.org/project/lovely.essequence/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lovely.essequence/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/lovelysystems/lovely.essequence" }, "release_url": "https://pypi.org/project/lovely.essequence/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "a persistent sequence generator for elasticsearch", "version": "0.1.0" }, "last_serial": 2252826, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ae6facb6283149220259dc253bfb5d14", "sha256": "29d69a9a0e29859ed1cce12c412dfb24d84ee9f595403d5d7a300547ee5ed311" }, "downloads": -1, "filename": "lovely.essequence-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ae6facb6283149220259dc253bfb5d14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3650, "upload_time": "2016-07-11T13:17:36", "url": "https://files.pythonhosted.org/packages/88/ed/e9c2c55d3ce73dbf121bab5f5fee7e7b8769a46faba5a077365a3c4b2399/lovely.essequence-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b5e5c589a4d7d6e7df6ad0a8a3a167e6", "sha256": "62ac07d1e7be89162d33ebe6c2b1a6842fed842843bcf4c39a9d22f8c1efe48a" }, "downloads": -1, "filename": "lovely.essequence-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b5e5c589a4d7d6e7df6ad0a8a3a167e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3650, "upload_time": "2016-07-12T12:19:53", "url": "https://files.pythonhosted.org/packages/34/77/09c2eed189370876393e5a304b6474d6855b58e0f36e643acee544f9e772/lovely.essequence-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "3c8c855154ed92ff1d97a9cd049a2c01", "sha256": "46ef85f3c8d03cc6374ff48d4307d85c3d72cc6be78fd7ef4efa1fb399ef247d" }, "downloads": -1, "filename": "lovely.essequence-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3c8c855154ed92ff1d97a9cd049a2c01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3667, "upload_time": "2016-07-30T17:18:03", "url": "https://files.pythonhosted.org/packages/e8/0f/3f78bf140b3f8d5b2f299b7454540bd3d76b2c9dcde4884ebaffc3343ae7/lovely.essequence-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3c8c855154ed92ff1d97a9cd049a2c01", "sha256": "46ef85f3c8d03cc6374ff48d4307d85c3d72cc6be78fd7ef4efa1fb399ef247d" }, "downloads": -1, "filename": "lovely.essequence-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3c8c855154ed92ff1d97a9cd049a2c01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3667, "upload_time": "2016-07-30T17:18:03", "url": "https://files.pythonhosted.org/packages/e8/0f/3f78bf140b3f8d5b2f299b7454540bd3d76b2c9dcde4884ebaffc3343ae7/lovely.essequence-0.1.0.tar.gz" } ] }