Distributed locking with DynamoDB
Project description
Distributed locking implementation in python with DynamoDB
Getting Started
To install DynaLock, simply use pip:
$ pip install dynalock
DynaLock utilizes Python’s context manager making it easier and safer to manage locks. When used in a with statement, DynaLock automatically acquires the lock at the beginning of the block and releases it upon exiting, regardless of whether the block exits normally or with an exception. This eliminates the need for explicit release calls, reducing the boilerplate code and minimizing the risk of errors.
Example Usage:
from dynalock import DynaLock
# Initialize a distributed lock
distributed_lock = DynaLock(
table_name='my_lock_table',
region_name='us-west-2',
lock_id='api_lock',
)
# Use the lock with a context manager
with distributed_lock.lock():
# Protected code goes here
# The lock is automatically managed
print("This code is protected by the lock")
print("Critical section executed")
# The lock is automatically released after exiting the block
print("This code is not protected by the lock")
Free software: MIT license
Full Documentation: https://dynalock.readthedocs.io.
History
0.1.0 (2024-03-30)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dynalock-0.3.0.tar.gz
.
File metadata
- Download URL: dynalock-0.3.0.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65737a0440557dc9b5cd2384683cd7d4d76429ed45f5f2488a91504b49885f7e |
|
MD5 | ed00be97018933dc1ec4cdafaafd1f82 |
|
BLAKE2b-256 | ce3ae72397aa35119ff41dfb20344ae3ceba9cd98a852183f252b730660bef99 |
File details
Details for the file dynalock-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dynalock-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a68a1cb51e8628ce4a21cc9daef3555025db22c5257c1f660aeaf62aad1dc30 |
|
MD5 | 93618e97b417eb29e849e91cb712a3e2 |
|
BLAKE2b-256 | ed36d207217e9b33c73b6014e274ca78779ee8727f63257d1e8cd14fec4dfcc7 |