Skip to content

Commit 0063f39

Browse files
committed
feature symfony#60138 [Lock] DynamoDB store (natepage)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Lock] DynamoDB store | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix symfony#59996 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT This PR introduces a new Lock store using AWS DynamoDb. The idea is coming from this [article](https://aws.amazon.com/blogs/database/building-distributed-locks-with-the-dynamodb-lock-client/). The implementation is heavily based on: - [DoctrineDbalStore](https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Lock/Store/DoctrineDbalStore.php) for the overall logic - [AmazonSqsMessenger Connection](https://github.com/symfony/amazon-sqs-messenger/blob/7.3/Transport/Connection.php) for the DSN/options handling Commits ------- 1256628 [Lock] DynamoDB store
2 parents 4808873 + 1256628 commit 0063f39

34 files changed

+698
-3
lines changed

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
- 8093:8093
122122
- 8094:8094
123123
- 11210:11210
124-
sqs:
124+
aws:
125125
image: localstack/localstack:3.0.2
126126
ports:
127127
- 4566:4566
@@ -254,6 +254,7 @@ jobs:
254254
run: ./phpunit --group integration
255255
env:
256256
INTEGRATION_FTP_URL: 'ftp://test:test@localhost'
257+
LOCK_DYNAMODB_DSN: "dynamodb://localhost:4566/lock_keys?sslmode=disable"
257258
REDIS_HOST: 'localhost:16379'
258259
REDIS_AUTHENTICATED_HOST: 'localhost:16380'
259260
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'

.github/workflows/package-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ jobs:
2121

2222
- name: Find packages
2323
id: find-packages
24-
run: echo "packages=$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin |jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))" >> $GITHUB_OUTPUT
24+
run: |
25+
all_packages=$(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin |jq -R -s -c 'split("\n")[:-1]')
26+
modified_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]')
27+
echo "packages=$(php .github/get-modified-packages.php $all_packages $modified_files)" >> $GITHUB_OUTPUT
2528
2629
- name: Verify meta files are correct
2730
run: |

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"require-dev": {
130130
"amphp/http-client": "^4.2.1|^5.0",
131131
"amphp/http-tunnel": "^1.0|^2.0",
132+
"async-aws/dynamo-db": "^3.0",
132133
"async-aws/ses": "^1.0",
133134
"async-aws/sqs": "^1.0|^2.0",
134135
"async-aws/sns": "^1.0",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore

src/Symfony/Component/Lock/Bridge/DynamoDb/.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Symfony/Component/Lock/Bridge/DynamoDb/.github/workflows/close-pull-request.yml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
7.4
5+
---
6+
7+
* Add the bridge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Amazon DynamoDB Lock
2+
====================
3+
4+
Provides [Amazon DynamoDB](https://async-aws.com/clients/dynamodb.html) integration for Symfony Lock.
5+
6+
DSN example
7+
-----------
8+
9+
```
10+
dynamodb://default/lock_keys
11+
```
12+
13+
where:
14+
- `default` means the DynamoDB client will use the default configuration
15+
- `lock_keys` is the name of the DynamoDB table to use
16+
17+
Resources
18+
---------
19+
20+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
21+
* [Report issues](https://github.com/symfony/symfony/issues) and
22+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
23+
in the [main Symfony repository](https://github.com/symfony/symfony)

0 commit comments

Comments
 (0)