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 2022/12/07 15:52:43 UTC

[shardingsphere] branch master updated: Rename AlgorithmDescription (#22732)

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

zhaojinchao 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 4df23a67822 Rename AlgorithmDescription (#22732)
4df23a67822 is described below

commit 4df23a67822ec696fe3d915733c048e8231cfbf3
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Dec 7 23:52:25 2022 +0800

    Rename AlgorithmDescription (#22732)
---
 .../infra/config/algorithm/AlgorithmDescription.java}               | 6 +++---
 .../core/api/impl/AbstractInventoryIncrementalJobAPIImpl.java       | 6 +++---
 .../algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java      | 4 ++--
 .../algorithm/DataMatchDataConsistencyCalculateAlgorithm.java       | 4 ++--
 .../core/fixture/DataConsistencyCalculateAlgorithmFixture.java      | 4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/annotation/SPIDescription.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/algorithm/AlgorithmDescription.java
similarity index 90%
rename from infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/annotation/SPIDescription.java
rename to infra/common/src/main/java/org/apache/shardingsphere/infra/config/algorithm/AlgorithmDescription.java
index e54b6939ddc..c176497571d 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/annotation/SPIDescription.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/algorithm/AlgorithmDescription.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.util.spi.annotation;
+package org.apache.shardingsphere.infra.config.algorithm;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -23,11 +23,11 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * SPI description.
+ * Algorithm description.
  */
 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
-public @interface SPIDescription {
+public @interface AlgorithmDescription {
     
     /**
      * Get description.
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractInventoryIncrementalJobAPIImpl.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractInventoryIncrementalJobAPIImpl.java
index 61776a6b37f..05ef1b6e850 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractInventoryIncrementalJobAPIImpl.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractInventoryIncrementalJobAPIImpl.java
@@ -49,7 +49,7 @@ import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
 import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.spi.annotation.SPIDescription;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmDescription;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 
 import java.util.Collection;
@@ -178,8 +178,8 @@ public abstract class AbstractInventoryIncrementalJobAPIImpl extends AbstractPip
         checkModeConfig();
         Collection<DataConsistencyCheckAlgorithmInfo> result = new LinkedList<>();
         for (DataConsistencyCalculateAlgorithm each : DataConsistencyCalculateAlgorithmFactory.getAllInstances()) {
-            SPIDescription spiDescription = each.getClass().getAnnotation(SPIDescription.class);
-            result.add(new DataConsistencyCheckAlgorithmInfo(each.getType(), getSupportedDatabaseTypes(each.getSupportedDatabaseTypes()), null == spiDescription ? "" : spiDescription.value()));
+            AlgorithmDescription description = each.getClass().getAnnotation(AlgorithmDescription.class);
+            result.add(new DataConsistencyCheckAlgorithmInfo(each.getType(), getSupportedDatabaseTypes(each.getSupportedDatabaseTypes()), null == description ? "" : description.value()));
         }
         return result;
     }
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
index 5e87b3b7808..c119604729f 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/CRC32MatchDataConsistencyCalculateAlgorithm.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.data.pipeline.core.sqlbuilder.PipelineSQLBuilde
 import org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.spi.annotation.SPIDescription;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmDescription;
 
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -44,7 +44,7 @@ import java.util.stream.Collectors;
 /**
  * CRC32 match data consistency calculate algorithm.
  */
-@SPIDescription("Match CRC32 of records.")
+@AlgorithmDescription("Match CRC32 of records.")
 @Slf4j
 public final class CRC32MatchDataConsistencyCalculateAlgorithm extends AbstractDataConsistencyCalculateAlgorithm {
     
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java
index 236b532d2d0..27590e50457 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/consistency/algorithm/DataMatchDataConsistencyCalculateAlgorithm.java
@@ -34,7 +34,7 @@ import org.apache.shardingsphere.data.pipeline.spi.ingest.dumper.ColumnValueRead
 import org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
-import org.apache.shardingsphere.infra.util.spi.annotation.SPIDescription;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmDescription;
 
 import java.math.BigDecimal;
 import java.sql.Connection;
@@ -56,7 +56,7 @@ import java.util.stream.Collectors;
 /**
  * Data match data consistency calculate algorithm.
  */
-@SPIDescription("Match raw data of records.")
+@AlgorithmDescription("Match raw data of records.")
 @Slf4j
 public final class DataMatchDataConsistencyCalculateAlgorithm extends AbstractStreamingDataConsistencyCalculateAlgorithm {
     
diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/DataConsistencyCalculateAlgorithmFixture.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/DataConsistencyCalculateAlgorithmFixture.java
index 902d795acdf..7d9c5a4ad03 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/DataConsistencyCalculateAlgorithmFixture.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/fixture/DataConsistencyCalculateAlgorithmFixture.java
@@ -23,14 +23,14 @@ import org.apache.shardingsphere.data.pipeline.api.check.consistency.DataConsist
 import org.apache.shardingsphere.data.pipeline.spi.check.consistency.DataConsistencyCalculateAlgorithm;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
-import org.apache.shardingsphere.infra.util.spi.annotation.SPIDescription;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmDescription;
 
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Properties;
 import java.util.stream.Collectors;
 
-@SPIDescription("Fixture description.")
+@AlgorithmDescription("Fixture description.")
 @Getter
 public final class DataConsistencyCalculateAlgorithmFixture implements DataConsistencyCalculateAlgorithm {