Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Lock] DynamoDB store #60138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: 7.3
Choose a base branch
from

Conversation

natepage
Copy link
Contributor

@natepage natepage commented Apr 4, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #59996
License MIT

This PR introduces a new Lock store using AWS DynamoDb. The idea is coming from this article.

The implementation is heavily based on:

@carsonbot

This comment has been minimized.

@natepage natepage marked this pull request as ready for review April 4, 2025 05:03
@natepage natepage requested a review from jderusse as a code owner April 4, 2025 05:03
@carsonbot carsonbot added this to the 7.3 milestone Apr 4, 2025
@carsonbot carsonbot changed the title [Lock][WIP] Initial pass on DynamoDb lock store [Lock] [WIP] Initial pass on DynamoDb lock store Apr 4, 2025
@natepage natepage changed the title [Lock] [WIP] Initial pass on DynamoDb lock store [Lock] DynamoDb store Apr 4, 2025
@stof
Copy link
Member

stof commented Apr 4, 2025

this new store should probably in a bridge package, so that we can manage its dependency properly.

@OskarStark OskarStark changed the title [Lock] DynamoDb store [Lock] DynamoDB store Apr 7, 2025
@natepage
Copy link
Contributor Author

natepage commented Apr 9, 2025

@stof Thank you for your feedback, I did move it to its own bridge, I'm not sure if I've done everything required from a structural POV.

I still didn't touch the tests yet

@OskarStark
Copy link
Contributor

this new store should probably in a bridge package, so that we can manage its dependency properly.

While I agree on that @stof, right now there is no Bridge namespace:
CleanShot 2025-04-09 at 12 14 02@2x

@stof
Copy link
Member

stof commented Apr 9, 2025

@OskarStark this does not prevent us from adding it if we need it.

@natepage
Copy link
Contributor Author

natepage commented Apr 9, 2025

@stof @OskarStark thank you for taking the time to review this 😄

I've actually updated the PR to add this Bridge namespace following the structure from the Messenger SQS example, but the package validation is failing and I'm unsure why as I've placed the composer.json file exactly in the same level as the Messenger SQS one, trying to investigate that right now

@natepage
Copy link
Contributor Author

natepage commented Apr 9, 2025

Yay! Package checks are passing, the match case for component_bridge wasn't behaving as expected, back onto PHP tests 😄

@OskarStark
Copy link
Contributor

Yes, we need to keep in mind, that we need to configure a proper split for the repo etc.

@natepage natepage requested review from stof and OskarStark April 10, 2025 12:41
@natepage
Copy link
Contributor Author

@stof @OskarStark

The current state of this is:

  • Moved the logic into its own component bridge
  • Implemented integration tests by using localstack in CI to have a local DynamoDB instance
  • Updated the default options logic based on feedback
  • Implemented unit tests for the store constructor logic (DSN/Options)

I have re-requested your reviews, thank you 😄

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more adjustments for this new package, and it looks good to me. I haven't read over the implementation in detail.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM.
Just a line of code that can be removed.

Comment on lines +110 to +114
if ('default' !== ($params['host'] ?? 'default')) {
$clientConfiguration['endpoint'] = \sprintf('%s://%s%s', ($options['sslmode'] ?? null) === 'disable' ? 'http' : 'https', $params['host'], ($params['port'] ?? null) ? ':'.$params['port'] : '');
if (preg_match(';^dynamodb\.([^\.]++)\.amazonaws\.com$;', $params['host'], $matches)) {
$clientConfiguration['region'] = $matches[1];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where this code is tested. Can you add a test case with a custom host?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GromNaN This test is setting host => localhost which tests that part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lock] DynamoDB store
5 participants