-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: define explicit state containers for providers #13423
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
Conversation
Test Results - Alternative Providers678 tests 399 ✅ 12m 47s ⏱️ Results for commit 80fb19b. ♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 1h 41m 10s ⏱️ Results for commit 80fb19b. ♻️ This comment has been updated with latest results. |
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 12m 57s ⏱️ - 52m 6s Results for commit 80fb19b. ± Comparison against base commit 42ed9a1. This pull request removes 909 tests.♻️ This comment has been updated with latest results. |
64d9a33 to
bc73f29
Compare
|
|
||
| class ResourcegroupstaggingapiProvider(ResourcegroupstaggingapiApi, ABC): | ||
| pass | ||
| def accept_state_visitor(self, visitor: StateVisitor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with this comment, I believe I will need to update this for the pro version of this provider in the future. Just had a few questions about how to implement this as I'm not 100% in the loop
- How would this work for services which have a only-pro implementation, is it just the case of defining this on the Pro provider?
- If a service has both a pro and community provider should we opt to define
accept_state_visitoron the community provider or the pro provider? (Does it even matter?) - In the future should everyone be making sure to implement the
accept_state_visitoron any new services they implement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've done it in a Pro PR that is still in the draft, I'll send it over to you!
For the questions:
- yes, defining it only in the Pro implementation is enough
- for both Pro and Community, as the Pro is a subclass of the Community, defining it only in the Community should be enough, except if the dependency is different (let's say we only depend on Moto in Community but add a Store in the Pro version, or we use the
Assets). Technically, as this relates to persistence, defining it in Pro only should be enough, but at least we make it clear here 👍 - very good question! yes, we should! we can have mechanism in place to ensure this going forward, like the persistence tests, if we remove the reflection locator 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect, thank you for clarifying!
giograno
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks for churning over all these services 💯 It looks all good to me!
Motivation
This PR reworks how we define the dependencies between the providers and their state containers. Previously, we've relied on the
ReflectionStateLocatorto automatically discover where the state for a service would be saved.This had several drawbacks: lots of magic and indirection, the need to follow some conventions that were sometimes tricky (the service name, the plural form of the
_storesprefix, etc). It has been extremely useful to migrate the whole codebase to the new store system a few years back, but we would like today to be more explicit about it.It also had the drawback to automatically attach the Moto state backends to a service if Moto implemented a service that LocalStack would implement, even if LocalStack had no dependency on that particular Moto service.
This will also help us to visualize the dependencies between the providers and where they store their state.
Changes
Migrate the following services to be explicit about their state containers:
acmapigatewaycloudwatch legacycloudwatch defaultconfigdynamodb(v1 and v2)dynamodbstreams v1dynamodbstreams v2ec2esevents v1events v2firehoseiamkmslogsresourcegroupsresourcegroupstaggingapiTests