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.2.0.tar.gz
.
File metadata
- Download URL: dynalock-0.2.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 | 1224ac6a02f68440a827a763cdfdc2728d829af9c6813747d2ddebe9fa54833b |
|
MD5 | 0ec00a936540426368e324dd7123b8e5 |
|
BLAKE2b-256 | a3671658500574f0123904c080a8776429b052a7534be48771cb8f16375fb24c |
File details
Details for the file dynalock-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dynalock-0.2.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 | 117134e99a108c4b5f1f4be270f254b6d4bd898bed6e1a23a8863250dd557b1a |
|
MD5 | 2e1a42ac8f966be34a793da899377b7f |
|
BLAKE2b-256 | fb240cc3650f07a3b9f395a2e5435d133720476775fd5afe892fb3d2fc1ff419 |