rfyiamcool / Pyetcdlock
Licence: mit
a mutux network lock based on etcd
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to Pyetcdlock
Vmesh
VMesh is a decentralized Layer 3 mesh router and protocol designed for open network interconnection.
Stars: ✭ 25 (+177.78%)
Mutual labels: network
Jetsonjs
Embed a JavaScript/WebGL application on a Nvidia Jetson TX2 and stream the results through websockets. It does not rely on CUDA/Jetpack. HDMI touchscreen, virtual keyboard, GPIO control, wifi config are included.
Stars: ✭ 18 (+100%)
Mutual labels: network
Nexer
Content based network multiplexer or redirector made with love and Go
Stars: ✭ 7 (-22.22%)
Mutual labels: network
Pitaya
🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines
Stars: ✭ 846 (+9300%)
Mutual labels: network
Js Collider
Java network (NIO) application framework: performance and scalability.
Stars: ✭ 25 (+177.78%)
Mutual labels: network
Naivecnn
A naive (very simple!) implementation of a convolutional neural network
Stars: ✭ 18 (+100%)
Mutual labels: network
Network Programming With Go
Network programming with Go
Stars: ✭ 903 (+9933.33%)
Mutual labels: network
Network miner
Network Miner generates a network map by sending SNMP requests (LLDP/CDP/EDP).
Stars: ✭ 25 (+177.78%)
Mutual labels: network
Librg
🚀 Making multi-player gamedev simpler since 2017
Stars: ✭ 813 (+8933.33%)
Mutual labels: network
Dat React Native
Browse through the web with the Dat protocol in your device!
Stars: ✭ 25 (+177.78%)
Mutual labels: network
Packetfence
PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) solution. Boasting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, powerful BYOD management options, 802.1X support, layer-2 isolation of problematic devices; PacketFence can be used to effectively secure networks small to very large heterogeneous networks.
Stars: ✭ 846 (+9300%)
Mutual labels: network
Stabping
Continuously monitor your connection/ISP's latency & speed and view them in interactive charts
Stars: ✭ 8 (-11.11%)
Mutual labels: network
Android Cookbook Examples
Contributed code examples from O'Reilly Android Cookbook. See #user-content-table README below!
Stars: ✭ 935 (+10288.89%)
Mutual labels: network
pyetcdlock
基于etcd的分布式锁,简单说就是利用etcd.test_and_set函数来判断lock key是否被占用,存在那就说明有人占用。在创建key的时候加入了ttl,防止因为进程异常退出而没有释放锁。
更新: 支持指定renew时间
renew(ttl=3)
待修复的问题:
针对etcd key 加入watch机制,解决客户端意外退出没有释放锁的问题.
曾经写过关于分布式互斥锁的文章:
安装方法
git clone https://github.com/rfyiamcool/pyetcdlock.git
cd pyetcdlock
python setup.py
pypi的安装方式 (话说,pypi有些问题,你在pypi search搜东西的时候,不显示详细信息)
pip instlal pyetcdlock
模块说明:
ttl : expire过期时间,这样可以指定锁定的时间
renew : 如果你的ttl时间将要过期了,那么可以使用renew(),再加点锁定的ttl时间
force_acquire : 强制获取锁
创建连接
import etcd
from pyetcdnetlock import Lock
client = client = etcd.Client(host='127.0.0.1')
lock = Lock(client, 'path/to/my/key', ttl=30, renewSecondsPrior=5)
使用方法
if lock.acquire(timeout=20):
# some work
lock.renew()
# some other work
lock.release()
else
# failed to acquire the lock in 20 seconds
pass
OR
with lock as l:
#如果时间不够,可以用renew()参数,加点时间
l.renew()
# some other work
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].