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")
    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)

Uploaded Source

Built Distribution

natspy_lock-0.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for natspy_lock-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b270bee8722865a0bb07fae149cd6b257daefa3bf5f0d69bcf9fb1d1b8343e4d
MD5 862277f5bb86ea8cab8cdb2f2f0c86f3
BLAKE2b-256 690b314048ae2bf6fbcec2e3c857ea4b01322d393501a2dac1524207a4b0a14d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natspy_lock-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae065595e4a6945990fca6454e00ac6a73370aa51629c8313f21a65114b6bbf
MD5 7ac40a581b102712b0c99907a298b5d5
BLAKE2b-256 785c7b67289e6da228cd0ae7d8547365f3e92168047a900a1c912e95ac5387c6

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