You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/11 15:43:55 UTC

[GitHub] [shardingsphere] likly opened a new pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

likly opened a new pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587


   Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] likly commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
likly commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-743275436


   This enum only be used in build-in sharding algorithms, just for easy manage the SPI type of build-in sharding algorithms.
   The user also can define custom sharidng algotithm with magic string or custom enum.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] likly commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
likly commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-744473877


   The user also can find how many built-in algorithms quickly throught the enum of ShardingAlgorithmType.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
terrymanu closed pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] likly commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
likly commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-743580420


   > Sharding algorithms are dynamic and loaded via SPI.
   > The enum is static config and broken OCP.
   > So it is better to do not use enum to define sharding algorithm types.
   
   This Enum only used for build-in sharding algorithms to manage the SPI types easily.
   And this enum is not broken OCP,  Sharding algorithms still are dynamic and loaded via SPI.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-749328266


   May I close this pr?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] likly commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
likly commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-744470387


   > > > Sharding algorithms are dynamic and loaded via SPI.
   > > > The enum is static config and broken OCP.
   > > > So it is better to do not use enum to define sharding algorithm types.
   > > 
   > > 
   > > This Enum only used for build-in sharding algorithms to manage the SPI types easily.
   > > And this enum is not broken OCP, Sharding algorithms still are dynamic and loaded via SPI.
   > 
   > If user custom a new sharding algorithm, do they need to update the enum?
   > If yes, OCP is broken;
   > If not the custom sharding algorithm is different with built-in one, we'd like keep the customization sharding algorithm consist with built-in one.
   
   Broken the OCI maybe appecd when the  `getType()` method  return type change to a enum type.
   But this enum just for replace the magic string with `enum.name()`.
   
   The getType method just changed like this:
   
   ```java
       public String getType() {
           // old: return "INLINE";
           // now: return the name of `INLINE` enum constant.
           return ShardingAlgorithmType.INLINE.name();
       }
   ```
   
   The method definition is not changed.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-744459697


   > > Sharding algorithms are dynamic and loaded via SPI.
   > > The enum is static config and broken OCP.
   > > So it is better to do not use enum to define sharding algorithm types.
   > 
   > This Enum only used for build-in sharding algorithms to manage the SPI types easily.
   > And this enum is not broken OCP, Sharding algorithms still are dynamic and loaded via SPI.
   
   If user custom a new sharding algorithm, do they need to update the enum? 
   If yes, OCP is broken; 
   If not the custom sharding algorithm is different with built-in one, we'd like keep the customization sharding algorithm consist with built-in one.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on pull request #8587: Add ShardingAlgorithmType enum to replace the sharing algorithm type with magic string.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-745116573


   we'd like keep the customization sharding algorithm consist with built-in one.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org