{ "info": { "author": "ruifengyun", "author_email": "rfyiamcool@163.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.0", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "#pyetcdlock\n\n\u57fa\u4e8eetcd\u7684\u5206\u5e03\u5f0f\u9501\uff0c\u7b80\u5355\u8bf4\u5c31\u662f\u5229\u7528etcd.test_and_set\u51fd\u6570\u6765\u5224\u65adlock key\u662f\u5426\u88ab\u5360\u7528\uff0c\u5b58\u5728\u90a3\u5c31\u8bf4\u660e\u6709\u4eba\u5360\u7528\u3002\u5728\u521b\u5efakey\u7684\u65f6\u5019\u52a0\u5165\u4e86ttl\uff0c\u9632\u6b62\u56e0\u4e3a\u8fdb\u7a0b\u5f02\u5e38\u9000\u51fa\u800c\u6ca1\u6709\u91ca\u653e\u9501\u3002\n\n\u66f4\u65b0\u65e5\u5fd7:\n\n\u52a0\u5165watch\u673a\u5236\uff0c\u66f4\u5feb\u7684\u89e3\u51b3\u4e86etcd\u5ba2\u6237\u7aef\u56e0\u4e3a\u5f02\u5e38\u9000\u51fa\u540e\uff0ckey\u9700\u8981\u7b49\u5f85ttl\u8fc7\u671f\u7684\u95ee\u9898\u3002\u7b80\u5355\u8bf4\uff0c\u6a21\u62df\u4e86zookeeper\u90a3\u79cd\u4e34\u65f6\u8282\u70b9\u7684\u6982\u5ff5\u3002 \n\n\n**\u66fe\u7ecf\u5199\u8fc7\u5173\u4e8e\u5206\u5e03\u5f0f\u4e92\u65a5\u9501\u7684\u6587\u7ae0:**\n\nzookeeper:\n[http://xiaorui.cc/2015/04/09/python-zookeeper%E8%A7%A3%E5%86%B3redis%E5%81%9A%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81%E5%B8%A6%E6%9D%A5%E7%9A%84%E5%9D%91/](http://xiaorui.cc/2015/04/09/python-zookeeper%E8%A7%A3%E5%86%B3redis%E5%81%9A%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81%E5%B8%A6%E6%9D%A5%E7%9A%84%E5%9D%91/) \n\nredis:\n[http://xiaorui.cc/2014/12/19/python%E4%BD%BF%E7%94%A8redis%E5%AE%9E%E7%8E%B0%E5%8D%8F%E5%90%8C%E6%8E%A7%E5%88%B6%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/](http://xiaorui.cc/2014/12/19/python%E4%BD%BF%E7%94%A8redis%E5%AE%9E%E7%8E%B0%E5%8D%8F%E5%90%8C%E6%8E%A7%E5%88%B6%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/)\n\n### \u5b89\u88c5\u65b9\u6cd5\n\n```\ngit clone https://github.com/rfyiamcool/pyetcdlock.git\ncd pyetcdlock\npython setup.py\n```\n\npypi\u7684\u5b89\u88c5\u65b9\u5f0f (\u8bdd\u8bf4\uff0cpypi\u6709\u4e9b\u95ee\u9898\uff0c\u4f60\u5728pypi search\u641c\u4e1c\u897f\u7684\u65f6\u5019\uff0c\u4e0d\u663e\u793a\u8be6\u7ec6\u4fe1\u606f)\n\n```\npip instlal pyetcdlock\n```\n\n\u6a21\u5757\u8bf4\u660e:\n\nttl : expire\u8fc7\u671f\u65f6\u95f4,\u8fd9\u6837\u53ef\u4ee5\u6307\u5b9a\u9501\u5b9a\u7684\u65f6\u95f4\n\nrenew : \u5982\u679c\u4f60\u7684ttl\u65f6\u95f4\u5c06\u8981\u8fc7\u671f\u4e86\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528renew(),\u518d\u52a0\u70b9\u9501\u5b9a\u7684ttl\u65f6\u95f4\n\nforce_acquire : \u5f3a\u5236\u83b7\u53d6\u9501\n\n\n### \u521b\u5efa\u8fde\u63a5\n\n```\nimport etcd\nfrom pyetcdnetlock import Lock\n\nclient = client = etcd.Client(host='127.0.0.1')\nlock = Lock(client, 'path/to/my/key', ttl=30, renewSecondsPrior=5)\n```\n\n### \u4f7f\u7528\u65b9\u6cd5\n\n```\nif lock.acquire(timeout=20):\n # some work\n lock.renew()\n # some other work\n lock.release() \nelse\n # failed to acquire the lock in 20 seconds\n pass\n\n```\n\nOR\n\n```\nwith lock as l:\n #\u5982\u679c\u65f6\u95f4\u4e0d\u591f\uff0c\u53ef\u4ee5\u7528renew()\u53c2\u6570\uff0c\u52a0\u70b9\u65f6\u95f4\n l.renew()\n # some other work\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rfyiamcool", "keywords": "mutux network lock based on etcd,fengyun", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pyetcdlock", "package_url": "https://pypi.org/project/pyetcdlock/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyetcdlock/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rfyiamcool" }, "release_url": "https://pypi.org/project/pyetcdlock/1.2.0/", "requires_dist": null, "requires_python": null, "summary": "python etcd network mutux lock,support watch ,force ,incr lock time", "version": "1.2.0" }, "last_serial": 1720351, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "03c1ade20998eff25eb4c0c27ded3d2e", "sha256": "1e7a6725eae7a31734ef13063e95922f251741df70462bebca4b17dc62858569" }, "downloads": -1, "filename": "pyetcdlock-1.0.0.tar.gz", "has_sig": false, "md5_digest": "03c1ade20998eff25eb4c0c27ded3d2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3607, "upload_time": "2015-09-13T02:57:57", "url": "https://files.pythonhosted.org/packages/7e/cc/0f7dc885f7a47b5a6e22dc85ecc738834ff02eb5fdefaa18e89eb4310452/pyetcdlock-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "1ac06fdec91e3a53d84f6ea3b9bdb461", "sha256": "3d646db7faf35476a86075835dd906ab581d107e21bc6d21786cb285f4495161" }, "downloads": -1, "filename": "pyetcdlock-1.1.0.tar.gz", "has_sig": false, "md5_digest": "1ac06fdec91e3a53d84f6ea3b9bdb461", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3429, "upload_time": "2015-09-13T03:06:08", "url": "https://files.pythonhosted.org/packages/3e/d6/bd2522ebe8697e0ed7f28a3af65e297976a2f372a4f9ff516991b7f3fe13/pyetcdlock-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "6412e9d3d419fb36336441a28424277b", "sha256": "88dbe7bdece0a59a4e7b0d66ee59ff78bc0a339a4df60b311900521ef5fb1c5d" }, "downloads": -1, "filename": "pyetcdlock-1.2.0.tar.gz", "has_sig": false, "md5_digest": "6412e9d3d419fb36336441a28424277b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3634, "upload_time": "2015-09-13T03:09:08", "url": "https://files.pythonhosted.org/packages/12/ad/f2b770413da933f4859c13c482ff244186115fc396a41f49e59076e507ca/pyetcdlock-1.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6412e9d3d419fb36336441a28424277b", "sha256": "88dbe7bdece0a59a4e7b0d66ee59ff78bc0a339a4df60b311900521ef5fb1c5d" }, "downloads": -1, "filename": "pyetcdlock-1.2.0.tar.gz", "has_sig": false, "md5_digest": "6412e9d3d419fb36336441a28424277b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3634, "upload_time": "2015-09-13T03:09:08", "url": "https://files.pythonhosted.org/packages/12/ad/f2b770413da933f4859c13c482ff244186115fc396a41f49e59076e507ca/pyetcdlock-1.2.0.tar.gz" } ] }