Skip to content

[Lock] Split "StoreInterface" into multiple interfaces with less responsability #32198

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

Simperfit
Copy link
Contributor

@Simperfit Simperfit commented Jun 26, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets Contribute to #28694
License MIT
Doc PR TODO

We are removing the StoreInterface in order to split into multiple interface, it will help reduce de responsability of the StoreInterface.

Firstly, since not all stores needs to have all the methods of the StoreInterface, we can split this like this in order to limit the methods that are needed for each store.

Secondly, we add supportsX methods in order to avoid throwing exception when a store does not supports a feature it's easier an instance of the special interface or not, and it can return true/false on the support method.

Really big thanks to @jderusse for working with me on this, 1-2 hours of talking together, and another 1-2 hours of pre-review :). now giving it to the whole community !

some time has been sponsored by @izisolutions

@Simperfit Simperfit changed the title [Lock] Split "StoreInterface" into multiple interfaces with less resp… [Lock] Split "StoreInterface" into multiple interfaces with less responsability Jun 26, 2019
@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch from 82d8e0e to 5f1ad1f Compare June 26, 2019 15:53
@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch 7 times, most recently from d9ffc80 to f00128e Compare June 26, 2019 18:01
@Simperfit
Copy link
Contributor Author

Status: Needs Review

@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch 2 times, most recently from 0cbc182 to 444acce Compare June 27, 2019 11:08
@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch from 444acce to e893032 Compare June 27, 2019 16:43
@Simperfit
Copy link
Contributor Author

Status: Needs Review

@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch from e893032 to c43a990 Compare June 27, 2019 16:45
@Simperfit Simperfit mentioned this pull request Jun 27, 2019
57 tasks
@fabpot
Copy link
Member

fabpot commented Jul 8, 2019

fabbot has some interesting fixes :)

@Simperfit Simperfit force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch 2 times, most recently from 8f5d0bd to e6e9977 Compare July 8, 2019 13:03
@Simperfit
Copy link
Contributor Author

cc @fabpot fixed.

@@ -70,6 +71,9 @@ public function acquire($blocking = false)
{
try {
if ($blocking) {
if (!($this->store instanceof StoreInterface) && !($this->store instanceof BlockingStoreInterface && $this->store->supportsWaitAndSave())) {
Copy link
Member

Choose a reason for hiding this comment

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

!($this->store instanceof StoreInterface) -> !$this->store instanceof StoreInterface

@fabpot fabpot force-pushed the feature/split-lock-store-interface-in-less-reponsability-interfaces branch from e6e9977 to 91fcbea Compare July 8, 2019 13:38
@fabpot
Copy link
Member

fabpot commented Jul 8, 2019

Thank you @Simperfit.

@fabpot fabpot merged commit 91fcbea into symfony:4.4 Jul 8, 2019
fabpot added a commit that referenced this pull request Jul 8, 2019
… with less responsability (Simperfit)

This PR was squashed before being merged into the 4.4 branch (closes #32198).

Discussion
----------

[Lock] Split "StoreInterface" into multiple interfaces with less responsability

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | Contribute to #28694 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | TODO <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

We are removing the StoreInterface in order to split into multiple interface, it will help reduce de responsability of the StoreInterface.

Firstly, since not all stores needs to have all the methods of the StoreInterface, we can split this like this in order to limit the methods that are needed for each store.

Secondly, we add supportsX methods in order to avoid throwing exception when a store does not supports a feature it's easier an instance of the special interface or not, and it can return true/false on the support method.

**Really big thanks to** @jderusse for working with me on this, 1-2 hours of talking together, and another 1-2 hours of pre-review :). now giving it to the whole community !

*some time has been sponsored by* @izisolutions

Commits
-------

91fcbea [Lock] Split \"StoreInterface\" into multiple interfaces with less responsability
@Simperfit Simperfit deleted the feature/split-lock-store-interface-in-less-reponsability-interfaces branch July 8, 2019 13:41
fabpot added a commit that referenced this pull request Jul 9, 2019
…Simperfit)

This PR was merged into the 4.4 branch.

Discussion
----------

[Lock] rename and deprecate Factory into LockFactory

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes<!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR         <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->
As highlighted in #32198 (review) we need to rename the factory to LockFactory for consistency and readability.

Commits
-------

fc75eb9 [Lock] rename and deprecate Factory into LockFactory
symfony-splitter pushed a commit to symfony/console that referenced this pull request Jul 9, 2019
…Simperfit)

This PR was merged into the 4.4 branch.

Discussion
----------

[Lock] rename and deprecate Factory into LockFactory

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes<!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR         <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->
As highlighted in symfony/symfony#32198 (review) we need to rename the factory to LockFactory for consistency and readability.

Commits
-------

fc75eb9bef [Lock] rename and deprecate Factory into LockFactory
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

I don't like the PersistStoreInterface name also, should be PersistingStoreInterface to be consistent with BlockingStoreInterface.

@@ -92,8 +93,12 @@ public function save(Key $key)
throw new LockConflictedException();
}

/**
* {@inheritdoc}
*/
Copy link
Member

Choose a reason for hiding this comment

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

missing @deprecated

public function waitAndSave(Key $key)
{
@trigger_error(sprintf('%s::%s has been deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', \get_class($this), __METHOD__), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

broken notice, __METHOD__ gives FQCN::method. Parentheses are missing also, and we usually don't add the and will be removed ... part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean the paretheses in %s() ?

@@ -69,8 +70,12 @@ public function save(Key $key)
$this->checkNotExpired($key);
}

/**
* {@inheritdoc}
*/
Copy link
Member

Choose a reason for hiding this comment

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

same

public function waitAndSave(Key $key)
{
@trigger_error(sprintf('%s has been deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__));
Copy link
Member

Choose a reason for hiding this comment

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

missing parentheses

@@ -145,6 +146,7 @@ public function save(Key $key)
*/
public function waitAndSave(Key $key)
{
@trigger_error(sprintf('%s has been deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__));
Copy link
Member

Choose a reason for hiding this comment

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

same

nicolas-grekas added a commit that referenced this pull request Jul 18, 2019
…ew (Simperfit)

This PR was squashed before being merged into the 4.4 branch (closes #32492).

Discussion
----------

[Lock] feature: lock split interface fix post-merge review

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yesish <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | none <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

see #32198 (review)

Commits
-------

8173c47 [Lock] feature: lock split interface fix post-merge review
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jul 18, 2019
…ew (Simperfit)

This PR was squashed before being merged into the 4.4 branch (closes #32492).

Discussion
----------

[Lock] feature: lock split interface fix post-merge review

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yesish <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | none <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

see symfony/symfony#32198 (review)

Commits
-------

8173c475f3 [Lock] feature: lock split interface fix post-merge review
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
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.

8 participants