DynamoDB Persistent Lock
Project description
Getting Started
Install the library
% python3 -m pip install dynamodb-persistent-lock
Usage
Non-async DynamoDB local download:
from dynamodb_persistent_lock import (
DynamoDBPersistentLockFactory,
DynamoDBPersistentLockClient,
)
from datetime import timedelta
...
# Create a lock factory
lock_factory = DynamoDBPersistentLockFactory(
table_name="locks",
region_name="eu-central-1",
partition_key_name="lock_key",
sort_key_name="sort_key",
record_version_number_name="rvn",
heartbeat_period=timedelta(seconds=10),
ttl_attribute_name="expire_at",
ttl_heartbeat_multiplier=3,
)
lock_factory.ensure_table()
...
# Open a lock client
lock_client = lock_factory.open_lock_client()
try:
lock_token = lock_client.try_acquire_lock("my_lock_key")
...
while lock_client.lock_acquired(lock_token):
# Lock-guarded code here.
finally:
lock_client.close()
Features
Creates a new lock, if there is none, in DynamoDB table.
Reacquires stale existing lock based on the ttl column value.
Keeps extending the ttl of an acquired lock with a given heartbeat rate.
Credits
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamodb_persistent_lock-0.0.6.tar.gz.
File metadata
- Download URL: dynamodb_persistent_lock-0.0.6.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66b5a3d18d86b31a90ef1298b5a82553f2682064cba94fcd6e7aec660a544a74
|
|
| MD5 |
032a2fbd2ae014fda789c03d21d81121
|
|
| BLAKE2b-256 |
755c68ecca7562a859b421f4d1779cb874c9f6af7f2ec0c4aa9c03c545a9e2ac
|
Provenance
The following attestation bundles were made for dynamodb_persistent_lock-0.0.6.tar.gz:
Publisher:
publish_pypi.yaml on timheiko/dynamodb-persistent-lock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dynamodb_persistent_lock-0.0.6.tar.gz -
Subject digest:
66b5a3d18d86b31a90ef1298b5a82553f2682064cba94fcd6e7aec660a544a74 - Sigstore transparency entry: 1306984222
- Sigstore integration time:
-
Permalink:
timheiko/dynamodb-persistent-lock@808ea78432645b4ff2078826ae79cacb66573d93 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/timheiko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yaml@808ea78432645b4ff2078826ae79cacb66573d93 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dynamodb_persistent_lock-0.0.6-py3-none-any.whl.
File metadata
- Download URL: dynamodb_persistent_lock-0.0.6-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4dbc36d4dcd3251f8ba302b2b1da7e920c729c3068ce781632529fe9e43aba0
|
|
| MD5 |
33a59a9d42ebf370743105e29a867ea0
|
|
| BLAKE2b-256 |
a3c9ad9f0e1da763d8265a590bcc9ec72371fab18f50786f67802e51de898b8e
|
Provenance
The following attestation bundles were made for dynamodb_persistent_lock-0.0.6-py3-none-any.whl:
Publisher:
publish_pypi.yaml on timheiko/dynamodb-persistent-lock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dynamodb_persistent_lock-0.0.6-py3-none-any.whl -
Subject digest:
d4dbc36d4dcd3251f8ba302b2b1da7e920c729c3068ce781632529fe9e43aba0 - Sigstore transparency entry: 1306984324
- Sigstore integration time:
-
Permalink:
timheiko/dynamodb-persistent-lock@808ea78432645b4ff2078826ae79cacb66573d93 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/timheiko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yaml@808ea78432645b4ff2078826ae79cacb66573d93 -
Trigger Event:
push
-
Statement type: