Skip to main content

Distributed lock library using nats.py

Project description

natspy-lock

PyPI - Version PyPI - Python Version


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)

Uploaded Source

Built Distribution

natspy_lock-0.0.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

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

Hashes for natspy_lock-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bcf21ba10cca6befce54daa698e7c239feb30f672cd70f3f81db7ca3a2ae877e
MD5 ff42b7bcc9feb50432e26374fca18d8a
BLAKE2b-256 a8f3d8b42cf35f4fea0d9a0b18a122014bd5aa674b6286bad3f111a0e285d85b

See more details on using hashes here.

File details

Details for the file natspy_lock-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for natspy_lock-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 912be03c744e4ae76184fcdf3b6881e0d81cbbe880837e97eaf4976a324b29f8
MD5 8201ac959e173c35454bca39b373591a
BLAKE2b-256 f6421a31aeab7f33d24333da2c7949b12e08d6c9e8baa1d32b31fdae7b8600c6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page