You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/06/16 06:05:23 UTC

[shardingsphere] branch master updated: update user-manual/config/java-api/sharding (#6063)

This is an automated email from the ASF dual-hosted git repository.

zhyee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 40ea117  update user-manual/config/java-api/sharding (#6063)
40ea117 is described below

commit 40ea117c3e76d5ecfe873f059b55e5b0d4bb2a82
Author: Liang Zhang <te...@163.com>
AuthorDate: Tue Jun 16 14:01:29 2020 +0800

    update user-manual/config/java-api/sharding (#6063)
---
 .../configuration/java-api/sharding.cn.md          | 108 +++++++++++---------
 .../configuration/java-api/sharding.en.md          | 110 ++++++++++++---------
 .../keygen/SnowflakeKeyGenerateAlgorithm.java      |  10 +-
 .../datetime/FixedIntervalShardingAlgorithm.java   |   2 +-
 4 files changed, 127 insertions(+), 103 deletions(-)

diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.cn.md
index 849ea0c..067f97b 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.cn.md
@@ -52,7 +52,7 @@ weight = 1
 
 ### 标准分片策略配置
 
-类名称:org.apache.shardingsphere.sharding.api.config.strategy.StandardShardingStrategyConfiguration
+类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration
 
 可配置属性:
 
@@ -61,11 +61,55 @@ weight = 1
 | shardingColumn        | String     | 分片列名称   |
 | shardingAlgorithmName | String     | 分片算法名称 |
 
+### 复合分片策略配置
+
+类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration
+
+可配置属性:
+
+| *名称*                 | *数据类型* | *说明*                    |
+| --------------------- | ---------- | ------------------------ |
+| shardingColumns       | String     | 分片列名称,多个列以逗号分隔 |
+| shardingAlgorithmName | String     | 分片算法名称               |
+
+### Hint 分片策略配置
+
+类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
+
+可配置属性:
+
+| *名称*                 | *数据类型*  | *说明*      |
+| --------------------- | ---------- | ----------- |
+| shardingAlgorithmName | String     | 分片算法名称  |
+
+### 不分片策略配置
+
+类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
+
+可配置属性:无
+
+## 自增主键策略配置
+
+类名称:org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
+
+可配置属性:
+
+| *名称*           | *数据类型* | *说明*         |
+| ---------------- | -------- | -------------- |
+| column           | String   | 自增列名称      |
+| keyGeneratorName | String   | 自增主键算法名称 |
+
+## 分片算法配置
+
+类名称:org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration
+
+### 标准分片算法配置
+
 Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 行表达式分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.inline.InlineShardingAlgorithm
+类型:INLINE
 
 可配置属性:
 
@@ -76,7 +120,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 取模分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.mod.ModShardingAlgorithm
+类型:MOD
 
 可配置属性:
 
@@ -86,7 +130,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 哈希取模分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.mod.HashModShardingAlgorithm
+类型:HASH_MOD
 
 可配置属性:
 
@@ -96,7 +140,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 基于分片容量的范围分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm
+类型:VOLUME_RANGE
 
 可配置属性:
 
@@ -108,7 +152,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 基于分片边界的范围分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm
+类型:BOUNDARY_RANGE
 
 可配置属性:
 
@@ -118,7 +162,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 定长时间段分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.datetime.FixedIntervalShardingAlgorithm
+类型:FIXED_INTERVAL
 
 可配置属性:
 
@@ -130,7 +174,7 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 
 #### 基于可变时间范围的分片算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.sharding.datetime.MutableIntervalShardingAlgorithm
+类型:MUTABLE_INTERVAL
 
 可配置属性:
 
@@ -143,53 +187,21 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
 | datetime.step.unit   | String    | TODO                                |
 | datetime.step.amount | String    | TODO                                |
 
-### 复合分片策略配置
-
-类名称:ComplexShardingStrategyConfiguration
+### 复合分片算法配置
 
-可配置属性:
+Apache ShardingSphere 暂无内置复合分片算法。
 
-| *名称*                 | *数据类型* | *说明*                    |
-| --------------------- | ---------- | ------------------------ |
-| shardingColumns       | String     | 分片列名称,多个列以逗号分隔 |
-| shardingAlgorithmName | String     | 分片算法名称               |
+### Hint 分片算法配置
 
-Apache ShardingSphere 暂无内置复合分片算法实现类。
+Apache ShardingSphere 暂无内置 Hint 分片算法。
 
-### Hint 分片策略配置
-
-类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
-
-可配置属性:
-
-| *名称*                 | *数据类型*  | *说明*      |
-| --------------------- | ---------- | ----------- |
-| shardingAlgorithmName | String     | 分片算法名称  |
-
-Apache ShardingSphere 暂无内置复合分片算法实现类。
-
-### 不分片策略配置
-
-类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
-
-可配置属性:无
-
-## 自增主键策略配置
-
-类名称:org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
-
-可配置属性:
-
-| *名称*           | *数据类型* | *说明*         |
-| ---------------- | -------- | -------------- |
-| column           | String   | 自增列名称      |
-| keyGeneratorName | String   | 自增主键算法名称 |
+## 自增主键算法配置
 
-Apache ShardingSphere 内置的自增主键算法实现类包括:
+Apache ShardingSphere 内置的自增主键算法包括:
 
 ### 雪花算法
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.keygen.SnowflakeKeyGenerateAlgorithm
+类型:SNOWFLAKE
 
 可配置属性:
 
@@ -201,6 +213,6 @@ Apache ShardingSphere 内置的自增主键算法实现类包括:
 
 ### UUID
 
-类名称:org.apache.shardingsphere.sharding.strategy.algorithm.keygen.UUIDKeyGenerateAlgorithm
+类型:UUID
 
 可配置属性:无
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.en.md
index 065d9b9..2656dbb 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/sharding.en.md
@@ -52,7 +52,7 @@ Attributes:
 
 ### Standard Sharding Strategy Configuration
 
-Class name: org.apache.shardingsphere.sharding.api.config.strategy.StandardShardingStrategyConfiguration
+Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration
 
 Attributes:
 
@@ -61,11 +61,55 @@ Attributes:
 | shardingColumn        | String     | Sharding column name    |
 | shardingAlgorithmName | String     | Sharding algorithm name |
 
-Apache ShardingSphere built-in implemented classes of StandardShardingAlgorithm are:
+### Complex Sharding Strategy Configuration
+
+Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration
+
+Attributes:
+
+| *Name*                | *DataType* | *Description*                             |
+| --------------------- | ---------- | ----------------------------------------- |
+| shardingColumns       | String     | Sharding column name, separated by commas |
+| shardingAlgorithmName | String     | Sharding algorithm name                   |
+
+### Hint Sharding Strategy Configuration
+
+Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
+
+Attributes:
+
+| *Name*                | *DataType* | *Description*           |
+| --------------------- | ---------- | ----------------------- |
+| shardingAlgorithmName | String     | Sharding algorithm name |
+
+### None Sharding Strategy Configuration
+
+Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
+
+Attributes: None
+
+## Key Generate Strategy Configuration
+
+Class name: org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
+
+Attributes:
+
+| *Name*           | *DataType* | *Description*               |
+| ---------------- | ---------- | --------------------------- |
+| column           | String     | Column name of key generate |
+| keyGeneratorName | String     | key generate algorithm name |
+
+## Sharding Algorithm Configuration
+
+Class name: org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration
+
+### Standard Sharding Algorithm Configuration
+
+Apache ShardingSphere built-in standard sharding algorithm are:
 
 #### Inline Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.inline.InlineShardingAlgorithm
+Type: INLINE
 
 Attributes:
 
@@ -76,7 +120,7 @@ Attributes:
 
 #### Modulo Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.mod.ModShardingAlgorithm
+Type: MOD
 
 Attributes:
 
@@ -86,7 +130,7 @@ Attributes:
 
 #### Hash Modulo Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.mod.HashModShardingAlgorithm
+Type: HASH_MOD
 
 Attributes:
 
@@ -96,7 +140,7 @@ Attributes:
 
 #### Volume Based Range Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm
+Type: VOLUME_RANGE
 
 Attributes:
 
@@ -108,7 +152,7 @@ Attributes:
 
 #### Boundary Based Range Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm
+Type: BOUNDARY_RANGE
 
 Attributes:
 
@@ -118,7 +162,7 @@ Attributes:
 
 #### Fixed Time Range Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.datetime.FixedIntervalShardingAlgorithm
+Type: FIXED_INTERVAL
 
 Attributes:
 
@@ -130,7 +174,7 @@ Attributes:
 
 #### Mutable Interval Sharding Algorithm
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.sharding.datetime.MutableIntervalShardingAlgorithm
+Type: MUTABLE_INTERVAL
 
 Attributes:
 
@@ -143,53 +187,21 @@ Attributes:
 | datetime.step.unit   | String     | TODO                                           |
 | datetime.step.amount | String     | TODO                                           |
 
-### Complex Sharding Strategy Configuration
-
-Class name: 类名称:org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
-
-Attributes:
-
-| *Name*                | *DataType* | *Description*                             |
-| --------------------- | ---------- | ----------------------------------------- |
-| shardingColumns       | String     | Sharding column name, separated by commas |
-| shardingAlgorithmName | String     | Sharding algorithm name                   |
+### Complex Sharding Algorithm Configuration
 
-There is no built-in complex keys sharding algorithm implementation class in Apache ShardingSphere.
+There is no built-in complex sharding algorithm in Apache ShardingSphere.
 
-### Hint Sharding Strategy Configuration
-
-Class name: HintShardingStrategyConfiguration
-
-Attributes:
+### Hint Sharding Algorithm Configuration
 
-| *Name*                | *DataType* | *Description*           |
-| --------------------- | ---------- | ----------------------- |
-| shardingAlgorithmName | String     | Sharding algorithm name |
-
-There is no built-in hint sharding algorithm implementation class in Apache ShardingSphere.
-
-### None Sharding Strategy Configuration
-
-Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
-
-Attributes: None
-
-## Key Generator Configuration
-
-Class name: org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
-
-Attributes:
+There is no built-in hint sharding algorithm in Apache ShardingSphere.
 
-| *Name*           | *DataType* | *Description*                |
-| ---------------- | ---------- | ---------------------------- |
-| column           | String     | Column name of key generate  |
-| keyGeneratorName | String     | key generate algorithm  name |
+## Key Generate Algorithm Configuration
 
-Apache ShardingSphere built-in implemented classes of KeyGenerateAlgorithm are:
+Apache ShardingSphere built-in key generate algorithm are:
 
 ### Snowflake
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.keygen.SnowflakeKeyGenerateAlgorithm
+Type: SNOWFLAKE
 
 Attributes:
 
@@ -201,6 +213,6 @@ Attributes:
 
 ### UUID
 
-Class name: org.apache.shardingsphere.sharding.strategy.algorithm.keygen.UUIDKeyGenerateAlgorithm
+Type: UUID
 
 Attributes: None
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
index e347b5f..ee6c4d0 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
@@ -100,11 +100,6 @@ public final class SnowflakeKeyGenerateAlgorithm implements KeyGenerateAlgorithm
     }
     
     @Override
-    public String getType() {
-        return "SNOWFLAKE";
-    }
-    
-    @Override
     public synchronized Comparable<?> generateKey() {
         long currentMilliseconds = timeService.getCurrentMillis();
         if (waitTolerateTimeDifferenceIfNeed(currentMilliseconds)) {
@@ -161,4 +156,9 @@ public final class SnowflakeKeyGenerateAlgorithm implements KeyGenerateAlgorithm
     private void vibrateSequenceOffset() {
         sequenceOffset = sequenceOffset >= getMaxVibrationOffset() ? 0 : sequenceOffset + 1;
     }
+    
+    @Override
+    public String getType() {
+        return "SNOWFLAKE";
+    }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/sharding/datetime/FixedIntervalShardingAlgorithm.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/sharding/datetime/FixedIntervalShardingAlgorithm.java
index 27c1112..71b04f4 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/sharding/datetime/FixedIntervalShardingAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/strategy/algorithm/sharding/datetime/FixedIntervalShardingAlgorithm.java
@@ -134,6 +134,6 @@ public final class FixedIntervalShardingAlgorithm implements StandardShardingAlg
     
     @Override
     public String getType() {
-        return "DATETIME";
+        return "FIXED_INTERVAL";
     }
 }