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")
kv = await nc.jetstream().key_value("test_lock")
lock = NatsLock(kv)
async with lock.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.0.2.tar.gz
(6.4 kB
view details)
Built Distribution
File details
Details for the file natspy_lock-0.0.2.tar.gz
.
File metadata
- Download URL: natspy_lock-0.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf21ba10cca6befce54daa698e7c239feb30f672cd70f3f81db7ca3a2ae877e |
|
MD5 | ff42b7bcc9feb50432e26374fca18d8a |
|
BLAKE2b-256 | a8f3d8b42cf35f4fea0d9a0b18a122014bd5aa674b6286bad3f111a0e285d85b |
File details
Details for the file natspy_lock-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: natspy_lock-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 912be03c744e4ae76184fcdf3b6881e0d81cbbe880837e97eaf4976a324b29f8 |
|
MD5 | 8201ac959e173c35454bca39b373591a |
|
BLAKE2b-256 | f6421a31aeab7f33d24333da2c7949b12e08d6c9e8baa1d32b31fdae7b8600c6 |