Distributed lock library using nats.py
Project description
natspy-lock
natspy-lock
is a distributed lock library using nats.
Table of Contents
Installation
pip install natspy-lock
Example
import nats
from natspy_lock import NatsLock
async def main():
nc = await nats.connect("nats://127.0.0.1:4222")
await NatsLock.init(nc.jetstream(), "test_lock", 60)
async with NatsLock.get_lock("test_lock", 1):
# do something
pass
await nc.drain()
License
natspy-lock
is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
natspy_lock-0.2.0.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file natspy_lock-0.2.0.tar.gz
.
File metadata
- Download URL: natspy_lock-0.2.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b270bee8722865a0bb07fae149cd6b257daefa3bf5f0d69bcf9fb1d1b8343e4d |
|
MD5 | 862277f5bb86ea8cab8cdb2f2f0c86f3 |
|
BLAKE2b-256 | 690b314048ae2bf6fbcec2e3c857ea4b01322d393501a2dac1524207a4b0a14d |
File details
Details for the file natspy_lock-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: natspy_lock-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ae065595e4a6945990fca6454e00ac6a73370aa51629c8313f21a65114b6bbf |
|
MD5 | 7ac40a581b102712b0c99907a298b5d5 |
|
BLAKE2b-256 | 785c7b67289e6da228cd0ae7d8547365f3e92168047a900a1c912e95ac5387c6 |