RaigorJiang edited a comment on issue #8330:
URL: https://github.com/apache/shardingsphere/issues/8330#issuecomment-734189671


   Hi, everyone~(especially @terrymanu )
   I want to discuss the solution of this feature.
   
   There are 3 types of ShardingAlgorithm which users can expand:
   StandardShardingAlgorithm, ComplexKeysShardingAlgorithm and 
HintShardingAlgorithm.
   
   I hava two plans:
   
   1. If we provide only ONE SPI implementation, the class should  implement 
these three interfaces, and the configuration may like this :
   > # 
        shardingAlgorithms:
         <sharding-algorithm-name> (+): # 分片算法名称
           type: CLASS_BASED   # 分片算法类型
           props: # 分片算法属性配置
             strategy: standard
             preciseAlgorithmClassName: org.xxx.example.PreciseShardingAlgorithm
             rangeAlgorithmClassName: org.xxx.example.RangeShardingAlgorithm
         <sharding-algorithm-name> (+): # 分片算法名称
           type: CLASS_BASED   # 分片算法类型
           props: # 分片算法属性配置
             strategy: complex
             algorithmClassName: org.xxx.example.ComplexKeysShardingAlgorithm
         <sharding-algorithm-name> (+): # 分片算法名称
           type: CLASS_BASED   # 分片算法类型
           props: # 分片算法属性配置
             strategy: hint
             algorithmClassName: org.xxx.example.HintShardingAlgorithm
         # ...
   
   
   2. We provide THREE SPI implementations, so their types can be different, 
and the configuration may like this : 
   > # 
         shardingAlgorithms:
           <sharding-algorithm-name> (+): # 分片算法名称
             type: CLASS_BASED_STANDARD   # 分片算法类型
             props: # 分片算法属性配置
               preciseAlgorithmClassName: 
org.xxx.example.PreciseShardingAlgorithm
               rangeAlgorithmClassName: org.xxx.example.RangeShardingAlgorithm
           <sharding-algorithm-name> (+): # 分片算法名称
             type: CLASS_BASED_COMPLEX   # 分片算法类型
             props: # 分片算法属性配置
               algorithmClassName: org.xxx.example.ComplexKeysShardingAlgorithm
           <sharding-algorithm-name> (+): # 分片算法名称
             type: CLASS_BASED_HINT   # 分片算法类型
             props: # 分片算法属性配置
               algorithmClassName: org.xxx.example.HintShardingAlgorithm
             # ...
   
   
   I prefer to the second one, can you give some suggestions?
   Thanks!
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to