You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/08/21 15:24:39 UTC
[shardingsphere] branch master updated: Refactor ShardingSphereMode
(#11937)
This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 534fe57 Refactor ShardingSphereMode (#11937)
534fe57 is described below
commit 534fe5735969e87e2066a2087ba12618be530cbc
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Aug 21 23:24:02 2021 +0800
Refactor ShardingSphereMode (#11937)
* Refactor ShardingSphereAutoConfiguration
* Remove useless PersistRepositoryFactory
* Add StandalonePersistRepository
* Add generic type of ShardingSphereMode
* Add generic type of ContextManagerBuilder
* Refactor ShardingSphereMode
* Rename LocalStandalonePersistRepository
* Rename LocalRepository
* Rename RegistryCenterRepository to ClusterPersistRepository
* Rename ClusterPersistRepositoryFactory
* Move StandalonePersistRepository
* Move StandalonePersistRepositoryConfiguration
* Rename DistMetaDataPersistService to PersistService
---
.../governance/context/ClusterContextManager.java | 50 +++++++++++-----------
.../context/ClusterContextManagerBuilder.java | 34 ++++++---------
.../context/ClusterContextManagerTest.java | 6 +--
.../core/lock/ShardingSphereDistributeLock.java | 6 +--
.../core/lock/service/LockRegistryService.java | 6 +--
.../governance/core/mode/ClusterMode.java | 14 ++----
.../governance/core/mode/ClusterModeBuilder.java | 15 +++----
...y.java => ClusterPersistRepositoryFactory.java} | 20 ++++-----
.../core/registry/GovernanceWatcherFactory.java | 4 +-
.../governance/core/registry/RegistryCenter.java | 8 ++--
.../core/registry/cache/RegistryCacheManager.java | 4 +-
.../subscriber/ScalingRegistrySubscriber.java | 6 +--
.../subscriber/GlobalRuleRegistrySubscriber.java | 4 +-
.../SchemaMetaDataRegistrySubscriber.java | 4 +-
.../subscriber/ProcessRegistrySubscriber.java | 6 +--
.../service/DataSourceStatusRegistryService.java | 4 +-
.../service/InstanceStatusRegistryService.java | 4 +-
.../state/service/UserStatusRegistryService.java | 4 +-
.../DataSourceStatusRegistrySubscriber.java | 6 +--
.../lock/ShardingSphereDistributeLockTest.java | 4 +-
.../core/lock/service/LockRegistryServiceTest.java | 14 +++---
...va => ClusterPersistRepositoryFactoryTest.java} | 4 +-
.../subscriber/ScalingRegistrySubscriberTest.java | 4 +-
...e.java => ClusterPersistRepositoryFixture.java} | 4 +-
.../SchemaMetaDataRegistrySubscriberTest.java | 4 +-
...rocessListClusterPersistRepositoryFixture.java} | 4 +-
.../ProcessRegistrySubscriberTestNoMock.java | 4 +-
.../subscriber/ProcessRegistrySubscriberTest.java | 4 +-
.../DataSourceStatusRegistryServiceTest.java | 4 +-
.../service/InstanceStatusRegistryServiceTest.java | 4 +-
.../DataSourceStatusRegistrySubscriberTest.java | 4 +-
...rnance.repository.spi.ClusterPersistRepository} | 4 +-
...pository.java => ClusterPersistRepository.java} | 6 +--
.../governance/repository/etcd/EtcdRepository.java | 4 +-
...rnance.repository.spi.ClusterPersistRepository} | 0
.../zookeeper/CuratorZookeeperRepository.java | 4 +-
...rnance.repository.spi.ClusterPersistRepository} | 0
.../infra/mode/ShardingSphereMode.java | 11 -----
.../infra/mode/impl/memory/MemoryMode.java | 8 ----
.../infra/mode/impl/standalone/StandaloneMode.java | 12 ++----
.../impl/standalone/StandaloneModeBuilder.java | 6 +--
.../standalone/StandalonePersistRepository.java} | 15 ++-----
.../StandalonePersistRepositoryConfiguration.java | 3 +-
.../mode/repository/PersistRepositoryFactory.java | 42 ------------------
...DataPersistService.java => PersistService.java} | 6 +--
...PersistRepository.java => LocalRepository.java} | 12 +++---
...itor.java => LocalRepositoryDeleteVisitor.java} | 4 +-
...ePersistRepositoryConfigurationYamlSwapper.java | 2 +-
...de.impl.standalone.StandalonePersistRepository} | 2 +-
...istServiceTest.java => PersistServiceTest.java} | 12 +++---
.../context/manager/ContextManagerBuilder.java | 6 ++-
.../manager/impl/MemoryContextManagerBuilder.java | 6 +--
.../impl/StandaloneContextManagerBuilder.java | 31 ++++++--------
.../infra/context/metadata/MetaDataContexts.java | 18 ++++----
.../context/metadata/MetaDataContextsBuilder.java | 6 +--
.../metadata/MetaDataContextsBuilderTest.java | 10 ++---
.../context/metadata/MetaDataContextsTest.java | 4 +-
.../driver/state/DriverStateContextTest.java | 4 +-
...tory.java => TestClusterPersistRepository.java} | 4 +-
...rnance.repository.spi.ClusterPersistRepository} | 2 +-
.../boot/ShardingSphereAutoConfiguration.java | 4 +-
...epositoryConfigurationBeanDefinitionParser.java | 2 +-
...tory.java => TestClusterPersistRepository.java} | 4 +-
.../resources/META-INF/rdb/sharding-cluster.xml | 2 +-
...rnance.repository.spi.ClusterPersistRepository} | 2 +-
.../database/CreateDatabaseBackendHandler.java | 2 +-
.../text/database/DropDatabaseBackendHandler.java | 2 +-
.../rdl/resource/AddResourceBackendHandler.java | 2 +-
.../rdl/resource/DropResourceBackendHandler.java | 2 +-
.../rdl/rule/RuleDefinitionBackendHandler.java | 2 +-
.../DatabaseCommunicationEngineFactoryTest.java | 4 +-
.../DatabaseCommunicationEngineTest.java | 4 +-
.../jdbc/connection/BackendConnectionTest.java | 4 +-
.../jdbc/datasource/JDBCBackendDataSourceTest.java | 4 +-
.../context/BackendExecutorContextTest.java | 4 +-
.../proxy/backend/context/ProxyContextTest.java | 10 ++---
.../DatabaseOperateBackendHandlerFactoryTest.java | 6 +--
.../mysql/executor/ShowDatabasesExecutorTest.java | 4 +-
.../mysql/executor/ShowTablesExecutorTest.java | 4 +-
.../mysql/executor/UseDatabaseExecutorTest.java | 4 +-
.../impl/BroadcastDatabaseBackendHandlerTest.java | 4 +-
.../SchemaAssignedDatabaseBackendHandlerTest.java | 4 +-
.../impl/UnicastDatabaseBackendHandlerTest.java | 4 +-
.../distsql/DistSQLBackendHandlerFactoryTest.java | 6 +--
.../distsql/ral/SetVariableBackendHandlerTest.java | 4 +-
...y.java => FixtureClusterPersistRepository.java} | 4 +-
...rnance.repository.spi.ClusterPersistRepository} | 2 +-
.../FrontDatabaseProtocolTypeFactoryTest.java | 8 ++--
.../frontend/mysql/MySQLFrontendEngineTest.java | 4 +-
.../MySQLAuthenticationEngineTest.java | 4 +-
.../MySQLAuthenticationHandlerTest.java | 4 +-
.../command/MySQLCommandExecutorFactoryTest.java | 4 +-
.../execute/MySQLComStmtExecuteExecutorTest.java | 4 +-
.../PostgreSQLAuthenticationEngineTest.java | 4 +-
.../PostgreSQLAuthenticationHandlerTest.java | 4 +-
.../parse/PostgreSQLComParseExecutorTest.java | 4 +-
.../scaling/core/api/ScalingAPIFactory.java | 10 ++---
.../core/api/impl/GovernanceRepositoryAPIImpl.java | 4 +-
98 files changed, 284 insertions(+), 377 deletions(-)
diff --git a/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManager.java b/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManager.java
index 19e3236..43bbf71 100644
--- a/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManager.java
+++ b/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManager.java
@@ -37,7 +37,7 @@ import org.apache.shardingsphere.governance.core.registry.metadata.event.SchemaD
import org.apache.shardingsphere.governance.core.registry.state.event.DisabledStateChangedEvent;
import org.apache.shardingsphere.governance.core.registry.state.event.PrimaryStateChangedEvent;
import org.apache.shardingsphere.governance.core.schema.GovernanceSchema;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
@@ -56,7 +56,7 @@ import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.optimize.core.metadata.FederateSchemaMetadata;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.ShardingSphereRulesBuilder;
import org.apache.shardingsphere.infra.rule.event.impl.DataSourceNameDisabledEvent;
@@ -83,7 +83,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public final class ClusterContextManager implements ContextManager {
- private final DistMetaDataPersistService distMetaDataPersistService;
+ private final PersistService persistService;
private final RegistryCenter registryCenter;
@@ -121,10 +121,10 @@ public final class ClusterContextManager implements ContextManager {
}
private void persistMetaData() {
- metaDataContexts.getMetaDataMap().forEach((key, value) -> distMetaDataPersistService.getSchemaMetaDataService().persist(key, value.getSchema()));
+ metaDataContexts.getMetaDataMap().forEach((key, value) -> persistService.getSchemaMetaDataService().persist(key, value.getSchema()));
}
- private ShardingSphereLock createShardingSphereLock(final RegistryCenterRepository repository) {
+ private ShardingSphereLock createShardingSphereLock(final ClusterPersistRepository repository) {
return metaDataContexts.getProps().<Boolean>getValue(ConfigurationPropertyKey.LOCK_ENABLED)
? new ShardingSphereDistributeLock(repository, metaDataContexts.getProps().<Long>getValue(ConfigurationPropertyKey.LOCK_WAIT_TIMEOUT_MILLISECONDS)) : null;
}
@@ -141,7 +141,7 @@ public final class ClusterContextManager implements ContextManager {
ShardingSphereMetaData metaData = buildMetaData(event.getSchemaName());
metaDataContexts.getOptimizeContextFactory().getSchemaMetadatas().getSchemas().put(event.getSchemaName(), new FederateSchemaMetadata(event.getSchemaName(), metaData.getSchema().getTables()));
metaDataContexts.getMetaDataMap().put(event.getSchemaName(), metaData);
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService,
+ metaDataContexts = new MetaDataContexts(persistService,
metaDataContexts.getMetaDataMap(), metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(),
metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
ShardingSphereEventBus.getInstance().post(new DataSourceChangeCompletedEvent(event.getSchemaName(),
@@ -160,7 +160,7 @@ public final class ClusterContextManager implements ContextManager {
Map<String, ShardingSphereMetaData> schemaMetaData = new HashMap<>(metaDataContexts.getMetaDataMap());
schemaMetaData.remove(schemaName);
metaDataContexts.getOptimizeContextFactory().getSchemaMetadatas().getSchemas().remove(schemaName);
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService,
+ metaDataContexts = new MetaDataContexts(persistService,
schemaMetaData, metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(), metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
ShardingSphereEventBus.getInstance().post(new DataSourceDeletedEvent(schemaName));
}
@@ -173,7 +173,7 @@ public final class ClusterContextManager implements ContextManager {
@Subscribe
public synchronized void renew(final PropertiesChangedEvent event) {
ConfigurationProperties props = new ConfigurationProperties(event.getProps());
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService,
+ metaDataContexts = new MetaDataContexts(persistService,
metaDataContexts.getMetaDataMap(), metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(), props, metaDataContexts.getOptimizeContextFactory());
}
@@ -205,7 +205,7 @@ public final class ClusterContextManager implements ContextManager {
metaDataContexts.getOptimizeContextFactory().getSchemaMetadatas().getSchemas().put(event.getSchemaName(),
new FederateSchemaMetadata(event.getSchemaName(), metaData.getSchema().getTables()));
}
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService,
+ metaDataContexts = new MetaDataContexts(persistService,
schemaMetaData, metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(), metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
} finally {
ShardingSphereEventBus.getInstance().post(new InnerLockReleasedEvent(LockNameUtil.getMetadataRefreshLockName()));
@@ -223,9 +223,9 @@ public final class ClusterContextManager implements ContextManager {
String schemaName = event.getSchemaName();
ShardingSphereMetaData metaData = getChangedMetaData(metaDataContexts.getMetaDataMap().get(schemaName), event.getRuleConfigurations());
Map<String, ShardingSphereMetaData> schemaMetaData = rebuildSchemaMetaData(schemaName, metaData);
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService, schemaMetaData, metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(),
+ metaDataContexts = new MetaDataContexts(persistService, schemaMetaData, metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(),
metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
- distMetaDataPersistService.getSchemaMetaDataService().persist(schemaName, schemaMetaData.get(schemaName).getSchema());
+ persistService.getSchemaMetaDataService().persist(schemaName, schemaMetaData.get(schemaName).getSchema());
}
/**
@@ -240,7 +240,7 @@ public final class ClusterContextManager implements ContextManager {
Collection<DataSource> pendingClosedDataSources = getPendingClosedDataSources(schemaName, event.getDataSourceConfigurations());
ShardingSphereMetaData metaData = rebuildMetaData(metaDataContexts.getMetaDataMap().get(schemaName), event.getDataSourceConfigurations());
Map<String, ShardingSphereMetaData> schemaMetaData = rebuildSchemaMetaData(schemaName, metaData);
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService, schemaMetaData,
+ metaDataContexts = new MetaDataContexts(persistService, schemaMetaData,
metaDataContexts.getGlobalRuleMetaData(), metaDataContexts.getExecutorEngine(), metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
ShardingSphereEventBus.getInstance().post(new DataSourceChangeCompletedEvent(event.getSchemaName(),
metaDataContexts.getMetaDataMap().get(event.getSchemaName()).getResource().getDatabaseType(), schemaMetaData.get(event.getSchemaName()).getResource().getDataSources()));
@@ -290,7 +290,7 @@ public final class ClusterContextManager implements ContextManager {
if (!newGlobalConfigs.isEmpty()) {
ShardingSphereRuleMetaData newGlobalRuleMetaData = new ShardingSphereRuleMetaData(newGlobalConfigs,
ShardingSphereRulesBuilder.buildGlobalRules(newGlobalConfigs, metaDataContexts.getMetaDataMap()));
- metaDataContexts = new MetaDataContexts(distMetaDataPersistService, metaDataContexts.getMetaDataMap(), newGlobalRuleMetaData, metaDataContexts.getExecutorEngine(),
+ metaDataContexts = new MetaDataContexts(persistService, metaDataContexts.getMetaDataMap(), newGlobalRuleMetaData, metaDataContexts.getExecutorEngine(),
metaDataContexts.getProps(), metaDataContexts.getOptimizeContextFactory());
}
}
@@ -303,20 +303,20 @@ public final class ClusterContextManager implements ContextManager {
}
private void persistSchema(final String schemaName) {
- if (!distMetaDataPersistService.getDataSourceService().isExisted(schemaName)) {
- distMetaDataPersistService.getDataSourceService().persist(schemaName, new LinkedHashMap<>());
+ if (!persistService.getDataSourceService().isExisted(schemaName)) {
+ persistService.getDataSourceService().persist(schemaName, new LinkedHashMap<>());
}
- if (!distMetaDataPersistService.getSchemaRuleService().isExisted(schemaName)) {
- distMetaDataPersistService.getSchemaRuleService().persist(schemaName, new LinkedList<>());
+ if (!persistService.getSchemaRuleService().isExisted(schemaName)) {
+ persistService.getSchemaRuleService().persist(schemaName, new LinkedList<>());
}
}
private ShardingSphereMetaData buildMetaData(final String schemaName) throws SQLException {
- Map<String, Map<String, DataSource>> dataSourcesMap = createDataSourcesMap(Collections.singletonMap(schemaName, distMetaDataPersistService.getDataSourceService().load(schemaName)));
+ Map<String, Map<String, DataSource>> dataSourcesMap = createDataSourcesMap(Collections.singletonMap(schemaName, persistService.getDataSourceService().load(schemaName)));
return new MetaDataContextsBuilder(dataSourcesMap,
- Collections.singletonMap(schemaName, distMetaDataPersistService.getSchemaRuleService().load(schemaName)),
- distMetaDataPersistService.getGlobalRuleService().load(),
- metaDataContexts.getProps().getProps()).build(distMetaDataPersistService).getMetaData(schemaName);
+ Collections.singletonMap(schemaName, persistService.getSchemaRuleService().load(schemaName)),
+ persistService.getGlobalRuleService().load(),
+ metaDataContexts.getProps().getProps()).build(persistService).getMetaData(schemaName);
}
private ShardingSphereMetaData getChangedMetaData(final ShardingSphereMetaData originalMetaData, final ShardingSphereSchema schema, final String schemaName) {
@@ -326,8 +326,8 @@ public final class ClusterContextManager implements ContextManager {
private ShardingSphereMetaData getChangedMetaData(final ShardingSphereMetaData originalMetaData, final Collection<RuleConfiguration> ruleConfigs) throws SQLException {
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(Collections.singletonMap(originalMetaData.getName(), originalMetaData.getResource().getDataSources()),
- Collections.singletonMap(originalMetaData.getName(), ruleConfigs), distMetaDataPersistService.getGlobalRuleService().load(), metaDataContexts.getProps().getProps());
- return builder.build(distMetaDataPersistService).getMetaDataMap().values().iterator().next();
+ Collections.singletonMap(originalMetaData.getName(), ruleConfigs), persistService.getGlobalRuleService().load(), metaDataContexts.getProps().getProps());
+ return builder.build(persistService).getMetaDataMap().values().iterator().next();
}
private ShardingSphereMetaData rebuildMetaData(final ShardingSphereMetaData originalMetaData, final Map<String, DataSourceConfiguration> newDataSourceConfigs) throws SQLException {
@@ -336,8 +336,8 @@ public final class ClusterContextManager implements ContextManager {
Map<String, Map<String, DataSource>> dataSourcesMap = Collections.singletonMap(originalMetaData.getName(),
getNewDataSources(originalMetaData.getResource().getDataSources(), getAddedDataSources(originalMetaData, newDataSourceConfigs), changedDataSources, deletedDataSources));
return new MetaDataContextsBuilder(dataSourcesMap, Collections.singletonMap(originalMetaData.getName(),
- originalMetaData.getRuleMetaData().getConfigurations()), distMetaDataPersistService.getGlobalRuleService().load(),
- metaDataContexts.getProps().getProps()).build(distMetaDataPersistService).getMetaData(originalMetaData.getName());
+ originalMetaData.getRuleMetaData().getConfigurations()), persistService.getGlobalRuleService().load(),
+ metaDataContexts.getProps().getProps()).build(persistService).getMetaData(originalMetaData.getName());
}
private Map<String, DataSource> getNewDataSources(final Map<String, DataSource> originalDataSources,
diff --git a/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManagerBuilder.java b/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManagerBuilder.java
index c6c24e5..30baf67 100644
--- a/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManagerBuilder.java
+++ b/shardingsphere-governance/shardingsphere-governance-context/src/main/java/org/apache/shardingsphere/governance/context/ClusterContextManagerBuilder.java
@@ -17,9 +17,8 @@
package org.apache.shardingsphere.governance.context;
-import com.google.common.base.Preconditions;
+import org.apache.shardingsphere.governance.core.mode.ClusterMode;
import org.apache.shardingsphere.governance.core.registry.RegistryCenter;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
@@ -29,9 +28,7 @@ import org.apache.shardingsphere.infra.context.manager.ContextManagerBuilder;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContextsBuilder;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
-import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
@@ -42,23 +39,20 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
/**
* Cluster context manager builder.
*/
-public final class ClusterContextManagerBuilder implements ContextManagerBuilder {
+public final class ClusterContextManagerBuilder implements ContextManagerBuilder<ClusterMode> {
@Override
- public ContextManager build(final ShardingSphereMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ public ContextManager build(final ClusterMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, final Collection<RuleConfiguration> globalRuleConfigs,
final Properties props, final boolean isOverwrite) throws SQLException {
- Optional<PersistRepository> persistRepository = mode.getPersistRepository();
- Preconditions.checkState(persistRepository.isPresent());
- DistMetaDataPersistService persistService = new DistMetaDataPersistService(persistRepository.get());
- RegistryCenter registryCenter = new RegistryCenter((RegistryCenterRepository) persistRepository.get());
+ PersistService persistService = new PersistService(mode.getRepository());
+ RegistryCenter registryCenter = new RegistryCenter(mode.getRepository());
persistConfigurations(persistService, dataSourcesMap, schemaRuleConfigs, globalRuleConfigs, props, isOverwrite);
// TODO Here may be some problems to load all schemaNames for JDBC
Collection<String> schemaNames = persistService.getSchemaMetaDataService().loadAllNames();
@@ -77,7 +71,7 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
return result;
}
- private void persistConfigurations(final DistMetaDataPersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ private void persistConfigurations(final PersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, final Collection<RuleConfiguration> globalRuleConfigs,
final Properties props, final boolean overwrite) {
if (!isEmptyLocalConfiguration(dataSourcesMap, schemaRuleConfigs, globalRuleConfigs, props)) {
@@ -106,22 +100,22 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
return result;
}
- private Map<String, Map<String, DataSource>> loadDataSourcesMap(final DistMetaDataPersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ private Map<String, Map<String, DataSource>> loadDataSourcesMap(final PersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Collection<String> schemaNames) {
Map<String, Map<String, DataSourceConfiguration>> loadedDataSourceConfigs = loadDataSourceConfigurations(persistService, schemaNames);
Map<String, Map<String, DataSourceConfiguration>> changedDataSourceConfigs = getChangedDataSourceConfigurations(dataSourcesMap, loadedDataSourceConfigs);
Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourcesMap);
- getChangedDataSources(changedDataSourceConfigs).entrySet().forEach(entry -> {
- if (result.containsKey(entry.getKey())) {
- result.get(entry.getKey()).putAll(entry.getValue());
+ getChangedDataSources(changedDataSourceConfigs).forEach((key, value) -> {
+ if (result.containsKey(key)) {
+ result.get(key).putAll(value);
} else {
- result.put(entry.getKey(), entry.getValue());
+ result.put(key, value);
}
});
return result;
}
- private Map<String, Map<String, DataSourceConfiguration>> loadDataSourceConfigurations(final DistMetaDataPersistService persistService, final Collection<String> schemaNames) {
+ private Map<String, Map<String, DataSourceConfiguration>> loadDataSourceConfigurations(final PersistService persistService, final Collection<String> schemaNames) {
Map<String, Map<String, DataSourceConfiguration>> result = new LinkedHashMap<>();
for (String each : schemaNames) {
result.put(each, persistService.getDataSourceService().load(each));
@@ -171,7 +165,7 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
return result;
}
- private Map<String, Collection<RuleConfiguration>> loadSchemaRules(final DistMetaDataPersistService persistService, final Collection<String> schemaNames) {
+ private Map<String, Collection<RuleConfiguration>> loadSchemaRules(final PersistService persistService, final Collection<String> schemaNames) {
return schemaNames.stream().collect(Collectors.toMap(
each -> each, each -> persistService.getSchemaRuleService().load(each), (oldValue, currentValue) -> oldValue, LinkedHashMap::new));
}
diff --git a/shardingsphere-governance/shardingsphere-governance-context/src/test/java/org/apache/shardingsphere/governance/context/ClusterContextManagerTest.java b/shardingsphere-governance/shardingsphere-governance-context/src/test/java/org/apache/shardingsphere/governance/context/ClusterContextManagerTest.java
index 033e046..2b651b4 100644
--- a/shardingsphere-governance/shardingsphere-governance-context/src/test/java/org/apache/shardingsphere/governance/context/ClusterContextManagerTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-context/src/test/java/org/apache/shardingsphere/governance/context/ClusterContextManagerTest.java
@@ -48,7 +48,7 @@ import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
import org.apache.shardingsphere.infra.optimize.core.metadata.FederateSchemaMetadatas;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.test.mock.MockedDataSource;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
@@ -89,7 +89,7 @@ public final class ClusterContextManagerTest {
private final ConfigurationProperties props = new ConfigurationProperties(new Properties());
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private DistMetaDataPersistService persistService;
+ private PersistService persistService;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private RegistryCenter registryCenter;
@@ -112,7 +112,7 @@ public final class ClusterContextManagerTest {
public void setUp() {
clusterContextManager = new ClusterContextManager(persistService, registryCenter);
clusterContextManager.init(
- new MetaDataContexts(mock(DistMetaDataPersistService.class), createMetaDataMap(), globalRuleMetaData, mock(ExecutorEngine.class), props, mockOptimizeContextFactory()),
+ new MetaDataContexts(mock(PersistService.class), createMetaDataMap(), globalRuleMetaData, mock(ExecutorEngine.class), props, mockOptimizeContextFactory()),
mock(TransactionContexts.class, RETURNS_DEEP_STUBS));
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLock.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLock.java
index 8ab2eb4..10d07e2 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLock.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLock.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.governance.core.lock.service.LockRegistryServic
import org.apache.shardingsphere.governance.core.lock.event.LockNotificationEvent;
import org.apache.shardingsphere.governance.core.lock.event.LockReleasedEvent;
import org.apache.shardingsphere.governance.core.registry.config.event.props.PropertiesChangedEvent;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
@@ -43,8 +43,8 @@ public final class ShardingSphereDistributeLock implements ShardingSphereLock {
private final Collection<String> lockedResources = new ArrayList<>();
- public ShardingSphereDistributeLock(final RegistryCenterRepository registryCenterRepository, final long lockTimeoutMilliseconds) {
- lockService = new LockRegistryService(registryCenterRepository);
+ public ShardingSphereDistributeLock(final ClusterPersistRepository repository, final long lockTimeoutMilliseconds) {
+ lockService = new LockRegistryService(repository);
this.lockTimeoutMilliseconds = lockTimeoutMilliseconds;
ShardingSphereEventBus.getInstance().register(this);
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryService.java
index 94248e4..3be98ae 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryService.java
@@ -21,7 +21,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import org.apache.shardingsphere.governance.core.GovernanceInstance;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
@@ -35,9 +35,9 @@ public final class LockRegistryService {
private final String instanceId;
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
- public LockRegistryService(final RegistryCenterRepository repository) {
+ public LockRegistryService(final ClusterPersistRepository repository) {
instanceId = GovernanceInstance.getInstance().getId();
this.repository = repository;
initLockNode();
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterMode.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterMode.java
index 518524a..5c4ccb7 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterMode.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterMode.java
@@ -17,23 +17,17 @@
package org.apache.shardingsphere.governance.core.mode;
+import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-
-import java.util.Optional;
/**
* Cluster mode.
*/
@RequiredArgsConstructor
+@Getter
public final class ClusterMode implements ShardingSphereMode {
- private final RegistryCenterRepository repository;
-
- @Override
- public Optional<PersistRepository> getPersistRepository() {
- return Optional.of(repository);
- }
+ private final ClusterPersistRepository repository;
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
index d46ffcc..ef11434 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.mode;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
import org.apache.shardingsphere.infra.mode.builder.ModeBuilder;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
@@ -32,19 +32,18 @@ import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
public final class ClusterModeBuilder implements ModeBuilder {
static {
- ShardingSphereServiceLoader.register(RegistryCenterRepository.class);
+ ShardingSphereServiceLoader.register(ClusterPersistRepository.class);
}
@Override
public ShardingSphereMode build(final ModeConfiguration config) {
- ClusterPersistRepositoryConfiguration clusterRepositoryConfig = (ClusterPersistRepositoryConfiguration) config.getRepository();
- return new ClusterMode(createRegistryCenterRepository(clusterRepositoryConfig));
+ return new ClusterMode(createClusterPersistRepository((ClusterPersistRepositoryConfiguration) config.getRepository()));
}
- private RegistryCenterRepository createRegistryCenterRepository(final ClusterPersistRepositoryConfiguration clusterRepositoryConfig) {
- Preconditions.checkNotNull(clusterRepositoryConfig, "Registry center configuration cannot be null.");
- RegistryCenterRepository result = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, clusterRepositoryConfig.getType(), clusterRepositoryConfig.getProps());
- result.init(clusterRepositoryConfig);
+ private ClusterPersistRepository createClusterPersistRepository(final ClusterPersistRepositoryConfiguration config) {
+ Preconditions.checkNotNull(config, "Cluster persist repository configuration cannot be null.");
+ ClusterPersistRepository result = TypedSPIRegistry.getRegisteredService(ClusterPersistRepository.class, config.getType(), config.getProps());
+ result.init(config);
return result;
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactory.java
similarity index 67%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactory.java
index 75ac756..ebcaf34 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactory.java
@@ -21,29 +21,29 @@ import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
/**
- * Registry center repository factory.
+ * Cluster persist repository factory.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class RegistryCenterRepositoryFactory {
+public final class ClusterPersistRepositoryFactory {
static {
- ShardingSphereServiceLoader.register(RegistryCenterRepository.class);
+ ShardingSphereServiceLoader.register(ClusterPersistRepository.class);
}
/**
- * Create new instance of registry center repository.
+ * Create new instance of cluster persist repository.
*
- * @param config registry center configuration
- * @return new instance of registry center repository
+ * @param config cluster persist repository configuration
+ * @return new instance of cluster persist repository
*/
- public static RegistryCenterRepository newInstance(final ClusterPersistRepositoryConfiguration config) {
- Preconditions.checkNotNull(config, "Registry center configuration cannot be null.");
- RegistryCenterRepository result = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, config.getType(), config.getProps());
+ public static ClusterPersistRepository newInstance(final ClusterPersistRepositoryConfiguration config) {
+ Preconditions.checkNotNull(config, "Cluster persist repository configuration cannot be null.");
+ ClusterPersistRepository result = TypedSPIRegistry.getRegisteredService(ClusterPersistRepository.class, config.getType(), config.getProps());
result.init(config);
return result;
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/GovernanceWatcherFactory.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/GovernanceWatcherFactory.java
index e252e16..555d2b6 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/GovernanceWatcherFactory.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/GovernanceWatcherFactory.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.registry;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
@@ -34,7 +34,7 @@ public final class GovernanceWatcherFactory {
ShardingSphereServiceLoader.register(GovernanceWatcher.class);
}
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
/**
* Watch listeners.
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
index 7d746ee..b0a434a 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.governance.core.registry.process.subscriber.Pro
import org.apache.shardingsphere.governance.core.registry.state.service.DataSourceStatusRegistryService;
import org.apache.shardingsphere.governance.core.registry.state.service.InstanceStatusRegistryService;
import org.apache.shardingsphere.governance.core.registry.state.subscriber.DataSourceStatusRegistrySubscriber;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import java.util.Collection;
@@ -39,7 +39,7 @@ public final class RegistryCenter {
private final String instanceId;
@Getter
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
@Getter
private final DataSourceStatusRegistryService dataSourceStatusService;
@@ -52,7 +52,7 @@ public final class RegistryCenter {
private final GovernanceWatcherFactory listenerFactory;
- public RegistryCenter(final RegistryCenterRepository repository) {
+ public RegistryCenter(final ClusterPersistRepository repository) {
this.repository = repository;
instanceId = GovernanceInstance.getInstance().getId();
dataSourceStatusService = new DataSourceStatusRegistryService(repository);
@@ -62,7 +62,7 @@ public final class RegistryCenter {
createSubscribers(repository);
}
- private void createSubscribers(final RegistryCenterRepository repository) {
+ private void createSubscribers(final ClusterPersistRepository repository) {
new SchemaMetaDataRegistrySubscriber(repository);
new GlobalRuleRegistrySubscriber(repository);
new DataSourceStatusRegistrySubscriber(repository);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/RegistryCacheManager.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/RegistryCacheManager.java
index 984553c..2e95e8e 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/RegistryCacheManager.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/RegistryCacheManager.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.governance.core.registry.cache;
import com.google.common.base.Joiner;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.governance.core.registry.cache.node.CacheNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import java.util.UUID;
@@ -32,7 +32,7 @@ public final class RegistryCacheManager {
private static final String PATH_SEPARATOR = "/";
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
/**
* Cache configuration.
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriber.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriber.java
index deecc87..47243e2 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriber.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriber.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.governance.core.registry.config.event.rule.Rule
import org.apache.shardingsphere.governance.core.registry.config.event.rule.SwitchRuleConfigurationEvent;
import org.apache.shardingsphere.infra.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.infra.persist.node.SchemaMetadataNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
@@ -38,13 +38,13 @@ import java.util.Collection;
// TODO move to scaling module
public final class ScalingRegistrySubscriber {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
private final SchemaRulePersistService persistService;
private final RegistryCacheManager registryCacheManager;
- public ScalingRegistrySubscriber(final RegistryCenterRepository repository) {
+ public ScalingRegistrySubscriber(final ClusterPersistRepository repository) {
this.repository = repository;
this.persistService = new SchemaRulePersistService(repository);
registryCacheManager = new RegistryCacheManager(repository);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/subscriber/GlobalRuleRegistrySubscriber.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/subscriber/GlobalRuleRegistrySubscriber.java
index a7c6c30..b8e2fcf 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/subscriber/GlobalRuleRegistrySubscriber.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/config/subscriber/GlobalRuleRegistrySubscriber.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.governance.core.registry.config.subscriber;
import com.google.common.base.Preconditions;
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.authority.api.config.AuthorityRuleConfiguration;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.governance.core.registry.state.service.UserStatusRegistryService;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.metadata.mapper.event.dcl.impl.CreateUserStatementEvent;
@@ -41,7 +41,7 @@ public final class GlobalRuleRegistrySubscriber {
private final UserStatusRegistryService userStatusRegistryService;
- public GlobalRuleRegistrySubscriber(final RegistryCenterRepository repository) {
+ public GlobalRuleRegistrySubscriber(final ClusterPersistRepository repository) {
persistService = new GlobalRulePersistService(repository);
userStatusRegistryService = new UserStatusRegistryService(repository);
ShardingSphereEventBus.getInstance().register(this);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
index fa27397..a78a9ed 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.registry.metadata.subscriber;
import com.google.common.eventbus.Subscribe;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;
@@ -30,7 +30,7 @@ public final class SchemaMetaDataRegistrySubscriber {
private final SchemaMetaDataPersistService persistService;
- public SchemaMetaDataRegistrySubscriber(final RegistryCenterRepository repository) {
+ public SchemaMetaDataRegistrySubscriber(final ClusterPersistRepository repository) {
persistService = new SchemaMetaDataPersistService(repository);
ShardingSphereEventBus.getInstance().register(this);
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriber.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriber.java
index c66d9f6..d627dbc 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriber.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriber.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteP
import org.apache.shardingsphere.governance.core.registry.process.event.ShowProcessListRequestEvent;
import org.apache.shardingsphere.governance.core.registry.process.event.ShowProcessListResponseEvent;
import org.apache.shardingsphere.governance.core.registry.process.node.ProcessNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessConstants;
import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessContext;
@@ -42,9 +42,9 @@ import java.util.stream.Collectors;
*/
public final class ProcessRegistrySubscriber {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
- public ProcessRegistrySubscriber(final RegistryCenterRepository repository) {
+ public ProcessRegistrySubscriber(final ClusterPersistRepository repository) {
this.repository = repository;
ShardingSphereEventBus.getInstance().register(this);
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryService.java
index adfc277..327b678 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryService.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.governance.core.registry.state.ResourceState;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import java.util.Collection;
import java.util.stream.Collectors;
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public final class DataSourceStatusRegistryService {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
/**
* Load disabled data source names.
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryService.java
index c61a7c3..16364cb 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryService.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.state.service;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
/**
* Instance status registry service.
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.governance.repository.spi.RegistryCenterReposit
@RequiredArgsConstructor
public final class InstanceStatusRegistryService {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
/**
* Register instance online.
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/UserStatusRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/UserStatusRegistryService.java
index c9f60be..9ad82cb 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/UserStatusRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/service/UserStatusRegistryService.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.state.service;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.metadata.user.yaml.config.YamlUsersConfigurationConverter;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
@@ -32,7 +32,7 @@ import java.util.Collection;
@RequiredArgsConstructor
public final class UserStatusRegistryService {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
/**
* Persist users.
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriber.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriber.java
index 3b5399f..49744e0 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriber.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriber.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.governance.core.registry.state.subscriber;
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.governance.core.registry.state.ResourceState;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.rule.event.impl.DataSourceDisabledEvent;
import org.apache.shardingsphere.infra.rule.event.impl.PrimaryDataSourceEvent;
@@ -30,9 +30,9 @@ import org.apache.shardingsphere.infra.rule.event.impl.PrimaryDataSourceEvent;
*/
public final class DataSourceStatusRegistrySubscriber {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
- public DataSourceStatusRegistrySubscriber(final RegistryCenterRepository repository) {
+ public DataSourceStatusRegistrySubscriber(final ClusterPersistRepository repository) {
this.repository = repository;
ShardingSphereEventBus.getInstance().register(this);
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLockTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLockTest.java
index 4bc78b4..eb53397 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLockTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/ShardingSphereDistributeLockTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.lock;
import org.apache.shardingsphere.governance.core.lock.service.LockRegistryService;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,7 +37,7 @@ public final class ShardingSphereDistributeLockTest {
@Mock
private LockRegistryService lockService;
- private final ShardingSphereDistributeLock lock = new ShardingSphereDistributeLock(mock(RegistryCenterRepository.class), 50L);
+ private final ShardingSphereDistributeLock lock = new ShardingSphereDistributeLock(mock(ClusterPersistRepository.class), 50L);
@Before
public void setUp() throws ReflectiveOperationException {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryServiceTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryServiceTest.java
index da96c61..325e718 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryServiceTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/lock/service/LockRegistryServiceTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.lock.service;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,33 +34,33 @@ import static org.mockito.Mockito.verify;
public final class LockRegistryServiceTest {
@Mock
- private RegistryCenterRepository registryCenterRepository;
+ private ClusterPersistRepository clusterPersistRepository;
private LockRegistryService lockRegistryService;
@Before
public void setUp() throws ReflectiveOperationException {
- lockRegistryService = new LockRegistryService(registryCenterRepository);
+ lockRegistryService = new LockRegistryService(clusterPersistRepository);
Field field = lockRegistryService.getClass().getDeclaredField("repository");
field.setAccessible(true);
- field.set(lockRegistryService, registryCenterRepository);
+ field.set(lockRegistryService, clusterPersistRepository);
}
@Test
public void assertTryLock() {
lockRegistryService.tryLock("test", 50L);
- verify(registryCenterRepository).tryLock(LockNode.getLockNodePath("test"), 50L, TimeUnit.MILLISECONDS);
+ verify(clusterPersistRepository).tryLock(LockNode.getLockNodePath("test"), 50L, TimeUnit.MILLISECONDS);
}
@Test
public void assertReleaseLock() {
lockRegistryService.releaseLock("test");
- verify(registryCenterRepository).releaseLock(LockNode.getLockNodePath("test"));
+ verify(clusterPersistRepository).releaseLock(LockNode.getLockNodePath("test"));
}
@Test
public void assertDeleteLockAck() {
lockRegistryService.deleteLockAck("test");
- verify(registryCenterRepository).delete(anyString());
+ verify(clusterPersistRepository).delete(anyString());
}
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactoryTest.java
similarity index 91%
rename from shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactoryTest.java
index f45e6d9..b9e2ae3 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/ClusterPersistRepositoryFactoryTest.java
@@ -25,11 +25,11 @@ import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-public final class RegistryCenterRepositoryFactoryTest {
+public final class ClusterPersistRepositoryFactoryTest {
@Test
public void assertNewInstance() {
ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration("TEST", "test_name", "127.0.0.1", new Properties());
- assertThat(RegistryCenterRepositoryFactory.newInstance(config).getType(), is("TEST"));
+ assertThat(ClusterPersistRepositoryFactory.newInstance(config).getType(), is("TEST"));
}
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
index 9dc4f1a..65193ad 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.cache.subscriber;
import org.apache.shardingsphere.governance.core.registry.cache.RegistryCacheManager;
import org.apache.shardingsphere.infra.persist.service.impl.SchemaRulePersistService;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,7 +32,7 @@ import java.lang.reflect.Field;
public final class ScalingRegistrySubscriberTest {
@Mock
- private RegistryCenterRepository repository;
+ private ClusterPersistRepository repository;
@Mock
private SchemaRulePersistService persistService;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/ClusterPersistRepositoryFixture.java
similarity index 92%
rename from shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/ClusterPersistRepositoryFixture.java
index 5e1fb26..77e80be 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/ClusterPersistRepositoryFixture.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry.fixture;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
@@ -25,7 +25,7 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
-public final class RegistryCenterRepositoryFixture implements RegistryCenterRepository {
+public final class ClusterPersistRepositoryFixture implements ClusterPersistRepository {
@Override
public void init(final ClusterPersistRepositoryConfiguration config) {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
index c3459cf..d685c02 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry.metadata.subscriber;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;
@@ -42,7 +42,7 @@ public final class SchemaMetaDataRegistrySubscriberTest {
@Before
public void setUp() throws ReflectiveOperationException {
- schemaMetaDataRegistrySubscriber = new SchemaMetaDataRegistrySubscriber(mock(RegistryCenterRepository.class));
+ schemaMetaDataRegistrySubscriber = new SchemaMetaDataRegistrySubscriber(mock(ClusterPersistRepository.class));
Field field = schemaMetaDataRegistrySubscriber.getClass().getDeclaredField("persistService");
field.setAccessible(true);
field.set(schemaMetaDataRegistrySubscriber, persistService);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListClusterPersistRepositoryFixture.java
similarity index 93%
rename from shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java
rename to shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListClusterPersistRepositoryFixture.java
index 7d869e8..6545357 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListClusterPersistRepositoryFixture.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.process;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-public final class ProcessListRegistryCenterRepositoryFixture implements RegistryCenterRepository {
+public final class ProcessListClusterPersistRepositoryFixture implements ClusterPersistRepository {
private static final Map<String, String> REGISTRY_DATA = new LinkedHashMap<>();
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessRegistrySubscriberTestNoMock.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessRegistrySubscriberTestNoMock.java
index d5d3eb7..7afdb2a 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessRegistrySubscriberTestNoMock.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessRegistrySubscriberTestNoMock.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteP
import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessUnitReportEvent;
import org.apache.shardingsphere.governance.core.registry.process.node.ProcessNode;
import org.apache.shardingsphere.governance.core.registry.process.subscriber.ProcessRegistrySubscriber;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroup;
import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
@@ -48,7 +48,7 @@ import static org.junit.Assert.assertThat;
public final class ProcessRegistrySubscriberTestNoMock {
- private final RegistryCenterRepository repository = new ProcessListRegistryCenterRepositoryFixture();
+ private final ClusterPersistRepository repository = new ProcessListClusterPersistRepositoryFixture();
private final ProcessRegistrySubscriber subscriber = new ProcessRegistrySubscriber(repository);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriberTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriberTest.java
index 3ccccaa..ab8eb4b 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriberTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/subscriber/ProcessRegistrySubscriberTest.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteP
import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessSummaryReportEvent;
import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessUnitReportEvent;
import org.apache.shardingsphere.governance.core.registry.process.event.ShowProcessListRequestEvent;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessConstants;
@@ -50,7 +50,7 @@ import static org.mockito.Mockito.when;
public final class ProcessRegistrySubscriberTest {
@Mock
- private RegistryCenterRepository repository;
+ private ClusterPersistRepository repository;
@InjectMocks
private ProcessRegistrySubscriber processRegistrySubscriber;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryServiceTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryServiceTest.java
index 699335d..af210d8 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryServiceTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/DataSourceStatusRegistryServiceTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry.state.service;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -34,7 +34,7 @@ import static org.mockito.Mockito.when;
public final class DataSourceStatusRegistryServiceTest {
@Mock
- private RegistryCenterRepository repository;
+ private ClusterPersistRepository repository;
@Test
public void assertLoadDisabledDataSources() {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryServiceTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryServiceTest.java
index b13871a..1bc09c8 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryServiceTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/service/InstanceStatusRegistryServiceTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry.state.service;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -30,7 +30,7 @@ import static org.mockito.Mockito.verify;
public final class InstanceStatusRegistryServiceTest {
@Mock
- private RegistryCenterRepository repository;
+ private ClusterPersistRepository repository;
@Test
public void assertRegisterInstanceOnline() {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriberTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriberTest.java
index eb33c81..f74cbac 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriberTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/state/subscriber/DataSourceStatusRegistrySubscriberTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.state.subscriber;
import org.apache.shardingsphere.governance.core.registry.state.ResourceState;
import org.apache.shardingsphere.governance.core.registry.state.node.StatesNode;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.rule.event.impl.DataSourceDisabledEvent;
import org.apache.shardingsphere.infra.rule.event.impl.PrimaryDataSourceEvent;
import org.junit.Test;
@@ -33,7 +33,7 @@ import static org.mockito.Mockito.verify;
public final class DataSourceStatusRegistrySubscriberTest {
@Mock
- private RegistryCenterRepository repository;
+ private ClusterPersistRepository repository;
@Test
public void assertUpdateDataSourceDisabledState() {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
similarity index 86%
rename from shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
index 58f4704..f2ff445 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
@@ -15,5 +15,5 @@
# limitations under the License.
#
-org.apache.shardingsphere.governance.core.registry.fixture.RegistryCenterRepositoryFixture
-org.apache.shardingsphere.governance.core.registry.process.ProcessListRegistryCenterRepositoryFixture
+org.apache.shardingsphere.governance.core.registry.fixture.ClusterPersistRepositoryFixture
+org.apache.shardingsphere.governance.core.registry.process.ProcessListClusterPersistRepositoryFixture
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/ClusterPersistRepository.java
similarity index 93%
rename from shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java
rename to shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/ClusterPersistRepository.java
index a78120b..356ba53 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/ClusterPersistRepository.java
@@ -24,14 +24,14 @@ import org.apache.shardingsphere.governance.repository.api.listener.DataChangedE
import java.util.concurrent.TimeUnit;
/**
- * Registry center repository.
+ * Cluster persist repository.
*/
-public interface RegistryCenterRepository extends PersistRepository {
+public interface ClusterPersistRepository extends PersistRepository {
/**
* Initialize registry center.
*
- * @param config registry center configuration
+ * @param config cluster persist repository configuration
*/
void init(ClusterPersistRepositoryConfiguration config);
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
index 50ccea5..d76a9b8 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
@@ -36,7 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.etcd.props.EtcdProperties;
import org.apache.shardingsphere.governance.repository.etcd.props.EtcdPropertyKey;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
@@ -52,7 +52,7 @@ import java.util.stream.Collectors;
* Registry repository of ETCD.
*/
@Slf4j
-public final class EtcdRepository implements RegistryCenterRepository {
+public final class EtcdRepository implements ClusterPersistRepository {
private Client client;
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere [...]
similarity index 100%
rename from shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/govern [...]
index 1b25657..b8181bb 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
@@ -36,7 +36,7 @@ import org.apache.shardingsphere.governance.repository.api.config.ClusterPersist
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.zookeeper.handler.CuratorZookeeperExceptionHandler;
import org.apache.shardingsphere.governance.repository.zookeeper.props.ZookeeperProperties;
import org.apache.shardingsphere.governance.repository.zookeeper.props.ZookeeperPropertyKey;
@@ -61,7 +61,7 @@ import java.util.concurrent.TimeUnit;
/**
* Registry repository of ZooKeeper.
*/
-public final class CuratorZookeeperRepository implements RegistryCenterRepository {
+public final class CuratorZookeeperRepository implements ClusterPersistRepository {
private final Map<String, CuratorCache> caches = new HashMap<>();
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/resources/META-INF/services [...]
similarity index 100%
rename from shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java
index a1129d8..277083f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java
@@ -17,19 +17,8 @@
package org.apache.shardingsphere.infra.mode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-
-import java.util.Optional;
-
/**
* ShardingSphere mode.
*/
public interface ShardingSphereMode {
-
- /**
- * Get persist repository.
- *
- * @return persist repository
- */
- Optional<PersistRepository> getPersistRepository();
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/memory/MemoryMode.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/memory/MemoryMode.java
index 32ded6b..868df9a 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/memory/MemoryMode.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/memory/MemoryMode.java
@@ -18,17 +18,9 @@
package org.apache.shardingsphere.infra.mode.impl.memory;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-
-import java.util.Optional;
/**
* Memory mode.
*/
public final class MemoryMode implements ShardingSphereMode {
-
- @Override
- public Optional<PersistRepository> getPersistRepository() {
- return Optional.empty();
- }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneMode.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneMode.java
index d0a56e6..eff11bc 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneMode.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneMode.java
@@ -17,22 +17,16 @@
package org.apache.shardingsphere.infra.mode.impl.standalone;
+import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-
-import java.util.Optional;
/**
* Standalone mode.
*/
@RequiredArgsConstructor
+@Getter
public final class StandaloneMode implements ShardingSphereMode {
- private final PersistRepository repository;
-
- @Override
- public Optional<PersistRepository> getPersistRepository() {
- return Optional.of(repository);
- }
+ private final StandalonePersistRepository repository;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
index 7efbfd8..30c4ba5 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandaloneModeBuilder.java
@@ -21,8 +21,6 @@ import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
import org.apache.shardingsphere.infra.mode.builder.ModeBuilder;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
-import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -34,13 +32,13 @@ import java.util.Properties;
public final class StandaloneModeBuilder implements ModeBuilder {
static {
- ShardingSphereServiceLoader.register(PersistRepository.class);
+ ShardingSphereServiceLoader.register(StandalonePersistRepository.class);
}
@Override
public ShardingSphereMode build(final ModeConfiguration config) {
PersistRepositoryConfiguration repositoryConfig = null == config.getRepository() ? new StandalonePersistRepositoryConfiguration("Local", new Properties()) : config.getRepository();
- return new StandaloneMode(TypedSPIRegistry.getRegisteredService(PersistRepository.class, repositoryConfig.getType(), repositoryConfig.getProps()));
+ return new StandaloneMode(TypedSPIRegistry.getRegisteredService(StandalonePersistRepository.class, repositoryConfig.getType(), repositoryConfig.getProps()));
}
@Override
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepository.java
similarity index 75%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepository.java
index a1129d8..6dd2a02 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/ShardingSphereMode.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepository.java
@@ -15,21 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.mode;
+package org.apache.shardingsphere.infra.mode.impl.standalone;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-import java.util.Optional;
-
/**
- * ShardingSphere mode.
+ * Standalone persist repository.
*/
-public interface ShardingSphereMode {
-
- /**
- * Get persist repository.
- *
- * @return persist repository
- */
- Optional<PersistRepository> getPersistRepository();
+public interface StandalonePersistRepository extends PersistRepository {
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepositoryConfiguration.java
similarity index 88%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepositoryConfiguration.java
index 1b18d13..f59e329 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/config/StandalonePersistRepositoryConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/impl/standalone/StandalonePersistRepositoryConfiguration.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.mode.config;
+package org.apache.shardingsphere.infra.mode.impl.standalone;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
import java.util.Properties;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/repository/PersistRepositoryFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/repository/PersistRepositoryFactory.java
deleted file mode 100644
index e5f1dd5..0000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/mode/repository/PersistRepositoryFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.mode.repository;
-
-import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguration;
-import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
-
-/**
- * Persist repository factory.
- */
-public final class PersistRepositoryFactory {
-
- static {
- ShardingSphereServiceLoader.register(PersistRepository.class);
- }
-
- /**
- * Create new instance of persist repository.
- *
- * @param config persist repository configuration
- * @return new instance of persist repository
- */
- public static PersistRepository newInstance(final PersistRepositoryConfiguration config) {
- return TypedSPIRegistry.getRegisteredService(PersistRepository.class, config.getType(), config.getProps());
- }
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistService.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/PersistService.java
similarity index 95%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistService.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/PersistService.java
index 3beb34d..f917ab8 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistService.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/PersistService.java
@@ -33,10 +33,10 @@ import java.util.Map.Entry;
import java.util.Properties;
/**
- * Dist meta data persist service.
+ * Persist service.
*/
@Getter
-public final class DistMetaDataPersistService {
+public final class PersistService {
private final DataSourcePersistService dataSourceService;
@@ -48,7 +48,7 @@ public final class DistMetaDataPersistService {
private final PropertiesPersistService propsService;
- public DistMetaDataPersistService(final PersistRepository repository) {
+ public PersistService(final PersistRepository repository) {
dataSourceService = new DataSourcePersistService(repository);
schemaMetaDataService = new SchemaMetaDataPersistService(repository);
schemaRuleService = new SchemaRulePersistService(repository);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalPersistRepository.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepository.java
similarity index 86%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalPersistRepository.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepository.java
index 747c001..2338630 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalPersistRepository.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepository.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.infra.persist.repository.local;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
+import org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepository;
import java.io.BufferedWriter;
import java.io.File;
@@ -35,10 +35,10 @@ import java.util.Properties;
import java.util.stream.Collectors;
/**
- * Local dist meta data persist repository.
+ * Local repository.
*/
@Slf4j
-public final class LocalPersistRepository implements PersistRepository {
+public final class LocalRepository implements StandalonePersistRepository {
private static final String DEFAULT_PERSIST_DIRECTORY = ".shardingsphere";
@@ -83,7 +83,7 @@ public final class LocalPersistRepository implements PersistRepository {
@Override
public void delete(final String key) {
try {
- Files.walkFileTree(Paths.get(path, key), new LocalDistMetaDataDeleteVisitor());
+ Files.walkFileTree(Paths.get(path, key), new LocalRepositoryDeleteVisitor());
} catch (final IOException ex) {
log.error("Delete local dist meta data key: {} failed", key, ex);
}
@@ -101,7 +101,7 @@ public final class LocalPersistRepository implements PersistRepository {
@Override
public void setProps(final Properties props) {
LocalRepositoryProperties localRepositoryProperties = new LocalRepositoryProperties(props);
- path = Optional.ofNullable(Strings.emptyToNull(localRepositoryProperties.getValue(LocalRepositoryPropertyKey.PATH)))
- .orElse(Joiner.on("/").join(System.getProperty("user.home"), DEFAULT_PERSIST_DIRECTORY));
+ path = Optional.ofNullable(
+ Strings.emptyToNull(localRepositoryProperties.getValue(LocalRepositoryPropertyKey.PATH))).orElse(Joiner.on("/").join(System.getProperty("user.home"), DEFAULT_PERSIST_DIRECTORY));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalDistMetaDataDeleteVisitor.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepositoryDeleteVisitor.java
similarity index 94%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalDistMetaDataDeleteVisitor.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepositoryDeleteVisitor.java
index 3dbb0c6..ece550f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalDistMetaDataDeleteVisitor.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/persist/repository/local/LocalRepositoryDeleteVisitor.java
@@ -25,9 +25,9 @@ import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
/**
- * Local dist meta data delete visitor.
+ * Local repository delete visitor.
*/
-public final class LocalDistMetaDataDeleteVisitor implements FileVisitor {
+public final class LocalRepositoryDeleteVisitor implements FileVisitor {
@Override
public FileVisitResult preVisitDirectory(final Object dir, final BasicFileAttributes attrs) {
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java
index c237b19..427227e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/mode/StandalonePersistRepositoryConfigurationYamlSwapper.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.infra.yaml.config.swapper.mode;
-import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
/**
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.repository.PersistRepository b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepository
similarity index 90%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.repository.PersistRepository
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepository
index d4fd189..d316006 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.repository.PersistRepository
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepository
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.persist.repository.local.LocalPersistRepository
+org.apache.shardingsphere.infra.persist.repository.local.LocalRepository
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistServiceTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/PersistServiceTest.java
similarity index 93%
rename from shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistServiceTest.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/PersistServiceTest.java
index eab2bc9..3cb8993 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/DistMetaDataPersistServiceTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/persist/PersistServiceTest.java
@@ -53,7 +53,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@RunWith(MockitoJUnitRunner.class)
-public final class DistMetaDataPersistServiceTest {
+public final class PersistServiceTest {
private static final String SCHEMA_RULE_YAML = "yaml/persist/data-schema-rule.yaml";
@@ -69,11 +69,11 @@ public final class DistMetaDataPersistServiceTest {
@Mock
private PropertiesPersistService propsService;
- private DistMetaDataPersistService distMetaDataPersistService;
+ private PersistService persistService;
@Before
public void setUp() throws ReflectiveOperationException {
- distMetaDataPersistService = new DistMetaDataPersistService(mock(PersistRepository.class));
+ persistService = new PersistService(mock(PersistRepository.class));
setField("dataSourceService", dataSourceService);
setField("schemaRuleService", schemaRuleService);
setField("globalRuleService", globalRuleService);
@@ -81,9 +81,9 @@ public final class DistMetaDataPersistServiceTest {
}
private void setField(final String name, final Object value) throws ReflectiveOperationException {
- Field field = distMetaDataPersistService.getClass().getDeclaredField(name);
+ Field field = persistService.getClass().getDeclaredField(name);
field.setAccessible(true);
- field.set(distMetaDataPersistService, value);
+ field.set(persistService, value);
}
@Test
@@ -92,7 +92,7 @@ public final class DistMetaDataPersistServiceTest {
Collection<RuleConfiguration> schemaRuleConfigs = createRuleConfigurations();
Collection<RuleConfiguration> globalRuleConfigs = createGlobalRuleConfigurations();
Properties props = createProperties();
- distMetaDataPersistService.persistConfigurations(
+ persistService.persistConfigurations(
Collections.singletonMap("foo_db", dataSourceConfigs), Collections.singletonMap("foo_db", schemaRuleConfigs), globalRuleConfigs, props, false);
verify(dataSourceService).persist("foo_db", dataSourceConfigs, false);
verify(schemaRuleService).persist("foo_db", schemaRuleConfigs, false);
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/ContextManagerBuilder.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/ContextManagerBuilder.java
index 0d13838..74e5b14 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/ContextManagerBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/ContextManagerBuilder.java
@@ -29,8 +29,10 @@ import java.util.Properties;
/**
* Context manager builder.
+ *
+ * @param <T> type of mode
*/
-public interface ContextManagerBuilder extends TypedSPI {
+public interface ContextManagerBuilder<T extends ShardingSphereMode> extends TypedSPI {
/**
* Build context manager.
@@ -44,6 +46,6 @@ public interface ContextManagerBuilder extends TypedSPI {
* @return context manager
* @throws SQLException SQL exception
*/
- ContextManager build(ShardingSphereMode mode, Map<String, Map<String, DataSource>> dataSourcesMap,
+ ContextManager build(T mode, Map<String, Map<String, DataSource>> dataSourcesMap,
Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, Collection<RuleConfiguration> globalRuleConfigs, Properties props, boolean isOverwrite) throws SQLException;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/MemoryContextManagerBuilder.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/MemoryContextManagerBuilder.java
index 8a4a45a..042d835 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/MemoryContextManagerBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/MemoryContextManagerBuilder.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.context.manager.ContextManagerBuilder;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContextsBuilder;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
-import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
+import org.apache.shardingsphere.infra.mode.impl.memory.MemoryMode;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
@@ -38,10 +38,10 @@ import java.util.Properties;
/**
* Memory context manager builder.
*/
-public final class MemoryContextManagerBuilder implements ContextManagerBuilder {
+public final class MemoryContextManagerBuilder implements ContextManagerBuilder<MemoryMode> {
@Override
- public ContextManager build(final ShardingSphereMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ public ContextManager build(final MemoryMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, final Collection<RuleConfiguration> globalRuleConfigs,
final Properties props, final boolean isOverwrite) throws SQLException {
MetaDataContexts metaDataContexts = new MetaDataContextsBuilder(dataSourcesMap, schemaRuleConfigs, globalRuleConfigs, props).build(null);
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/StandaloneContextManagerBuilder.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/StandaloneContextManagerBuilder.java
index 78dc6fa..6833834 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/StandaloneContextManagerBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/manager/impl/StandaloneContextManagerBuilder.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.context.manager.impl;
-import com.google.common.base.Preconditions;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
@@ -27,9 +26,8 @@ import org.apache.shardingsphere.infra.context.manager.ContextManagerBuilder;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContextsBuilder;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
-import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
-import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.mode.impl.standalone.StandaloneMode;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
@@ -40,22 +38,19 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
/**
* Standalone context manager builder.
*/
-public final class StandaloneContextManagerBuilder implements ContextManagerBuilder {
+public final class StandaloneContextManagerBuilder implements ContextManagerBuilder<StandaloneMode> {
@Override
- public ContextManager build(final ShardingSphereMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ public ContextManager build(final StandaloneMode mode, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, final Collection<RuleConfiguration> globalRuleConfigs,
final Properties props, final boolean isOverwrite) throws SQLException {
- Optional<PersistRepository> persistRepository = mode.getPersistRepository();
- Preconditions.checkState(persistRepository.isPresent());
- DistMetaDataPersistService persistService = new DistMetaDataPersistService(persistRepository.get());
+ PersistService persistService = new PersistService(mode.getRepository());
persistConfigurations(persistService, dataSourcesMap, schemaRuleConfigs, globalRuleConfigs, props, isOverwrite);
Collection<String> schemaNames = persistService.getSchemaMetaDataService().loadAllNames();
MetaDataContexts metaDataContexts;
@@ -73,7 +68,7 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
return result;
}
- private void persistConfigurations(final DistMetaDataPersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ private void persistConfigurations(final PersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Map<String, Collection<RuleConfiguration>> schemaRuleConfigs, final Collection<RuleConfiguration> globalRuleConfigs,
final Properties props, final boolean overwrite) {
if (!isEmptyLocalConfiguration(dataSourcesMap, schemaRuleConfigs, globalRuleConfigs, props)) {
@@ -102,22 +97,22 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
return result;
}
- private Map<String, Map<String, DataSource>> loadDataSourcesMap(final DistMetaDataPersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
+ private Map<String, Map<String, DataSource>> loadDataSourcesMap(final PersistService persistService, final Map<String, Map<String, DataSource>> dataSourcesMap,
final Collection<String> schemaNames) {
Map<String, Map<String, DataSourceConfiguration>> loadedDataSourceConfigs = loadDataSourceConfigurations(persistService, schemaNames);
Map<String, Map<String, DataSourceConfiguration>> changedDataSourceConfigs = getChangedDataSourceConfigurations(dataSourcesMap, loadedDataSourceConfigs);
Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourcesMap);
- getChangedDataSources(changedDataSourceConfigs).entrySet().forEach(entry -> {
- if (result.containsKey(entry.getKey())) {
- result.get(entry.getKey()).putAll(entry.getValue());
+ getChangedDataSources(changedDataSourceConfigs).forEach((key, value) -> {
+ if (result.containsKey(key)) {
+ result.get(key).putAll(value);
} else {
- result.put(entry.getKey(), entry.getValue());
+ result.put(key, value);
}
});
return result;
}
- private Map<String, Map<String, DataSourceConfiguration>> loadDataSourceConfigurations(final DistMetaDataPersistService persistService, final Collection<String> schemaNames) {
+ private Map<String, Map<String, DataSourceConfiguration>> loadDataSourceConfigurations(final PersistService persistService, final Collection<String> schemaNames) {
Map<String, Map<String, DataSourceConfiguration>> result = new LinkedHashMap<>();
for (String each : schemaNames) {
result.put(each, persistService.getDataSourceService().load(each));
@@ -167,7 +162,7 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
return result;
}
- private Map<String, Collection<RuleConfiguration>> loadSchemaRules(final DistMetaDataPersistService persistService, final Collection<String> schemaNames) {
+ private Map<String, Collection<RuleConfiguration>> loadSchemaRules(final PersistService persistService, final Collection<String> schemaNames) {
return schemaNames.stream().collect(Collectors.toMap(
each -> each, each -> persistService.getSchemaRuleService().load(each), (oldValue, currentValue) -> oldValue, LinkedHashMap::new));
}
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContexts.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContexts.java
index 9e3d2fd..a4d37c9 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContexts.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContexts.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.state.StateContext;
import java.util.Collection;
@@ -41,7 +41,7 @@ import java.util.Properties;
@Getter
public final class MetaDataContexts {
- private final DistMetaDataPersistService distMetaDataPersistService;
+ private final PersistService persistService;
private final Map<String, ShardingSphereMetaData> metaDataMap;
@@ -55,14 +55,14 @@ public final class MetaDataContexts {
private final StateContext stateContext;
- public MetaDataContexts(final DistMetaDataPersistService persistService) {
+ public MetaDataContexts(final PersistService persistService) {
this(persistService, new LinkedHashMap<>(), new ShardingSphereRuleMetaData(Collections.emptyList(), Collections.emptyList()),
null, new ConfigurationProperties(new Properties()), new OptimizeContextFactory(new HashMap<>()));
}
- public MetaDataContexts(final DistMetaDataPersistService persistService, final Map<String, ShardingSphereMetaData> metaDataMap, final ShardingSphereRuleMetaData globalRuleMetaData,
+ public MetaDataContexts(final PersistService persistService, final Map<String, ShardingSphereMetaData> metaDataMap, final ShardingSphereRuleMetaData globalRuleMetaData,
final ExecutorEngine executorEngine, final ConfigurationProperties props, final OptimizeContextFactory optimizeContextFactory) {
- this.distMetaDataPersistService = persistService;
+ this.persistService = persistService;
this.metaDataMap = new LinkedHashMap<>(metaDataMap);
this.globalRuleMetaData = globalRuleMetaData;
this.executorEngine = executorEngine;
@@ -72,12 +72,12 @@ public final class MetaDataContexts {
}
/**
- * Get dist meta data persist service.
+ * Get persist service.
*
- * @return dist meta data persist service
+ * @return persist service
*/
- public Optional<DistMetaDataPersistService> getDistMetaDataPersistService() {
- return Optional.ofNullable(distMetaDataPersistService);
+ public Optional<PersistService> getPersistService() {
+ return Optional.ofNullable(persistService);
}
/**
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilder.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilder.java
index 418d477..4eb012e 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilder.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.infra.context.metadata;
import org.apache.shardingsphere.infra.config.DatabaseAccessConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -85,11 +85,11 @@ public final class MetaDataContextsBuilder {
/**
* Build meta data contexts.
*
- * @param persistService dist meta data persist service
+ * @param persistService persist service
* @exception SQLException SQL exception
* @return meta data contexts
*/
- public MetaDataContexts build(final DistMetaDataPersistService persistService) throws SQLException {
+ public MetaDataContexts build(final PersistService persistService) throws SQLException {
Map<String, ShardingSphereMetaData> metaDataMap = new HashMap<>(schemaRuleConfigs.size(), 1);
Map<String, ShardingSphereMetaData> actualMetaDataMap = new HashMap<>(schemaRuleConfigs.size(), 1);
for (String each : schemaRuleConfigs.keySet()) {
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilderTest.java b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilderTest.java
index aaefba6..90fede4 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilderTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsBuilderTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.infra.context.metadata;
import org.apache.shardingsphere.authority.api.config.AuthorityRuleConfiguration;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.context.fixture.FixtureRule;
import org.apache.shardingsphere.infra.context.fixture.FixtureRuleConfiguration;
@@ -47,7 +47,7 @@ public final class MetaDataContextsBuilderTest {
@Test
public void assertBuildWithoutConfiguration() throws SQLException {
- MetaDataContexts actual = new MetaDataContextsBuilder(Collections.emptyMap(), Collections.emptyMap(), null).build(mock(DistMetaDataPersistService.class));
+ MetaDataContexts actual = new MetaDataContextsBuilder(Collections.emptyMap(), Collections.emptyMap(), null).build(mock(PersistService.class));
assertTrue(actual.getAllSchemaNames().isEmpty());
assertTrue(actual.getProps().getProps().isEmpty());
}
@@ -57,7 +57,7 @@ public final class MetaDataContextsBuilderTest {
Properties props = new Properties();
props.setProperty(ConfigurationPropertyKey.EXECUTOR_SIZE.getKey(), "1");
MetaDataContexts actual = new MetaDataContextsBuilder(Collections.singletonMap("logic_db", Collections.emptyMap()),
- Collections.singletonMap("logic_db", Collections.singletonList(new FixtureRuleConfiguration())), props).build(mock(DistMetaDataPersistService.class));
+ Collections.singletonMap("logic_db", Collections.singletonList(new FixtureRuleConfiguration())), props).build(mock(PersistService.class));
assertRules(actual);
assertTrue(actual.getMetaData("logic_db").getResource().getDataSources().isEmpty());
assertThat(actual.getProps().getProps().size(), is(1));
@@ -69,7 +69,7 @@ public final class MetaDataContextsBuilderTest {
Properties props = new Properties();
props.setProperty(ConfigurationPropertyKey.EXECUTOR_SIZE.getKey(), "1");
MetaDataContexts actual = new MetaDataContextsBuilder(Collections.singletonMap("logic_db", Collections.singletonMap("ds", new MockedDataSource())),
- Collections.singletonMap("logic_db", Collections.singletonList(new FixtureRuleConfiguration())), props).build(mock(DistMetaDataPersistService.class));
+ Collections.singletonMap("logic_db", Collections.singletonList(new FixtureRuleConfiguration())), props).build(mock(PersistService.class));
assertRules(actual);
assertDataSources(actual);
assertThat(actual.getProps().getProps().size(), is(1));
@@ -84,7 +84,7 @@ public final class MetaDataContextsBuilderTest {
AuthorityRuleConfiguration authorityRuleConfig = new AuthorityRuleConfiguration(Collections.singleton(user), null);
MetaDataContexts actual = new MetaDataContextsBuilder(Collections.singletonMap("logic_db", Collections.emptyMap()),
Collections.singletonMap("logic_db", Collections.singletonList(new FixtureRuleConfiguration())),
- Collections.singleton(authorityRuleConfig), props).build(mock(DistMetaDataPersistService.class));
+ Collections.singleton(authorityRuleConfig), props).build(mock(PersistService.class));
assertRules(actual);
assertTrue(actual.getMetaData("logic_db").getResource().getDataSources().isEmpty());
assertThat(actual.getProps().getProps().size(), is(1));
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsTest.java b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsTest.java
index d76c487..84871f3 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/metadata/MetaDataContextsTest.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.database.DefaultSchema;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -47,7 +47,7 @@ public final class MetaDataContextsTest {
@Test
public void assertGetDefaultMetaData() {
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), Collections.singletonMap(DefaultSchema.LOGIC_NAME, metaData),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), Collections.singletonMap(DefaultSchema.LOGIC_NAME, metaData),
mock(ShardingSphereRuleMetaData.class), null, new ConfigurationProperties(new Properties()), optimizeContextFactory);
assertThat(metaDataContexts.getMetaData(DefaultSchema.LOGIC_NAME), is(metaData));
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java
index 7ba3e16..a5f7c2a 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/state/DriverStateContextTest.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConne
import org.apache.shardingsphere.infra.context.manager.ContextManager;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.database.DefaultSchema;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.Before;
import org.junit.Test;
@@ -48,7 +48,7 @@ public final class DriverStateContextTest {
@Before
public void setUp() {
- when(contextManager.getMetaDataContexts()).thenReturn(new MetaDataContexts(mock(DistMetaDataPersistService.class)));
+ when(contextManager.getMetaDataContexts()).thenReturn(new MetaDataContexts(mock(PersistService.class)));
}
@Test
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestClusterPersistRepository.java
similarity index 93%
rename from shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestClusterPersistRepository.java
index 66f5005..45b95f0 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestClusterPersistRepository.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.driver.governance.fixture;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.database.DefaultSchema;
import java.util.Collections;
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-public final class TestRegistryCenterRepository implements RegistryCenterRepository {
+public final class TestClusterPersistRepository implements ClusterPersistRepository {
private final Map<String, String> registryData = new LinkedHashMap<>();
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
similarity index 90%
rename from shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
index 5a4315e..76ed061 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.driver.governance.fixture.TestRegistryCenterRepository
+org.apache.shardingsphere.driver.governance.fixture.TestClusterPersistRepository
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.java
index 48de376..8f217e8 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.java
@@ -72,8 +72,8 @@ public class ShardingSphereAutoConfiguration implements EnvironmentAware {
@Bean
@Autowired(required = false)
public DataSource shardingSphereDataSource(final ObjectProvider<List<RuleConfiguration>> rules) throws SQLException {
- Collection<RuleConfiguration> ruleConfigurations = Optional.ofNullable(rules.getIfAvailable()).orElse(Collections.emptyList());
- return ShardingSphereDataSourceFactory.createDataSource(schemaName, dataSourceMap, ruleConfigurations, props.getProps());
+ Collection<RuleConfiguration> ruleConfigs = Optional.ofNullable(rules.getIfAvailable()).orElse(Collections.emptyList());
+ return ShardingSphereDataSourceFactory.createDataSource(schemaName, dataSourceMap, ruleConfigs, props.getProps());
}
/**
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/parser/StandaloneModeRepositoryConfigurationBeanDefinitionParser.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/parser/StandaloneModeRepositoryConfigurationBeanDefi [...]
index 4880e6c..00db9a1 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/parser/StandaloneModeRepositoryConfigurationBeanDefinitionParser.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/parser/StandaloneModeRepositoryConfigurationBeanDefinitionParser.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.spring.namespace.parser;
-import org.apache.shardingsphere.infra.mode.config.StandalonePersistRepositoryConfiguration;
+import org.apache.shardingsphere.infra.mode.impl.standalone.StandalonePersistRepositoryConfiguration;
import org.apache.shardingsphere.spring.namespace.tag.StandaloneModeRepositoryBeanDefinitionTag;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestClusterPersistReposi [...]
similarity index 92%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestClusterPersistRepository.java
index e7e3858..addc181 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestClusterPersistRepository.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.spring.namespace.governance.registry;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
@@ -25,7 +25,7 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
-public final class TestRegistryCenterRepository implements RegistryCenterRepository {
+public final class TestClusterPersistRepository implements ClusterPersistRepository {
@Override
public void init(final ClusterPersistRepositoryConfiguration config) {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml
index 17fea54..667ceca 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml
@@ -38,7 +38,7 @@
<prop key="operation-timeout-milliseconds">1000</prop>
</util:properties>
- <cluster:repository id="clusterRepository" type="TestRegistry" namespace="registryCenterRepository" server-lists="localhost:3182">
+ <cluster:repository id="clusterRepository" type="TestRegistry" namespace="clusterPersistRepository" server-lists="localhost:3182">
<props>
<prop key="max-retries">3</prop>
<prop key="operation-timeout-milliseconds">1000</prop>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPe [...]
similarity index 96%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
index 42d8b29..aff7587 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.spring.namespace.governance.registry.TestRegistryCenterRepository
+org.apache.shardingsphere.spring.namespace.governance.registry.TestClusterPersistRepository
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
index 1719acb..15a8d61 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
@@ -37,7 +37,7 @@ public final class CreateDatabaseBackendHandler implements TextProtocolBackendHa
public ResponseHeader execute() {
check(sqlStatement);
// TODO update meta data context in memory
- ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDistMetaDataPersistService().ifPresent(
+ ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().ifPresent(
optional -> optional.getSchemaMetaDataService().persist(sqlStatement.getDatabaseName(), null));
return new UpdateResponseHeader(sqlStatement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
index 901da43..effa292 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
@@ -44,7 +44,7 @@ public final class DropDatabaseBackendHandler implements TextProtocolBackendHand
backendConnection.setCurrentSchema(null);
}
// TODO update meta data context in memory
- ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDistMetaDataPersistService().ifPresent(
+ ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().ifPresent(
optional -> optional.getSchemaMetaDataService().delete(sqlStatement.getDatabaseName()));
return new UpdateResponseHeader(sqlStatement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AddResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AddResourceBackendHandler.java
index 3619c3f..778a6e4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AddResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AddResourceBackendHandler.java
@@ -69,7 +69,7 @@ public final class AddResourceBackendHandler extends SchemaRequiredBackendHandle
}
// TODO update meta data context in memory
ProxyContext.getInstance().getContextManager()
- .getMetaDataContexts().getDistMetaDataPersistService().ifPresent(optional -> optional.getDataSourceService().append(schemaName, dataSourceConfigs));
+ .getMetaDataContexts().getPersistService().ifPresent(optional -> optional.getDataSourceService().append(schemaName, dataSourceConfigs));
return new UpdateResponseHeader(sqlStatement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
index a7a085e..7ff5607 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
@@ -54,7 +54,7 @@ public final class DropResourceBackendHandler extends SchemaRequiredBackendHandl
check(schemaName, toBeDroppedResourceNames);
drop(schemaName, toBeDroppedResourceNames);
// TODO update meta data context in memory
- ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDistMetaDataPersistService().ifPresent(
+ ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().ifPresent(
optional -> optional.getDataSourceService().drop(schemaName, toBeDroppedResourceNames));
return new UpdateResponseHeader(sqlStatement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
index 338b1b5..53fafbd 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
@@ -111,7 +111,7 @@ public final class RuleDefinitionBackendHandler<T extends RuleDefinitionStatemen
}
private void persistRuleConfigurationChange(final ShardingSphereMetaData shardingSphereMetaData) {
- ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDistMetaDataPersistService().ifPresent(optional -> optional.getSchemaRuleService().persist(
+ ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().ifPresent(optional -> optional.getSchemaRuleService().persist(
shardingSphereMetaData.getName(), shardingSphereMetaData.getRuleMetaData().getConfigurations()));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactoryTest.java
index 1fc52d4..7acc19f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactoryTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.backend.communication;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.context.manager.ContextManager;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType;
@@ -50,7 +50,7 @@ public final class DatabaseCommunicationEngineFactoryTest {
public void setUp() throws IllegalAccessException, NoSuchFieldException {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mockOptimizeContextFactory());
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineTest.java
index 985f430..18aff91 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineTest.java
@@ -36,7 +36,7 @@ import org.apache.shardingsphere.infra.metadata.schema.model.IndexMetaData;
import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
import org.apache.shardingsphere.infra.optimize.core.metadata.FederateSchemaMetadatas;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -89,7 +89,7 @@ public final class DatabaseCommunicationEngineTest {
public void setUp() {
when(backendConnection.getSchemaName()).thenReturn("schema");
MetaDataContexts metaDataContexts = new MetaDataContexts(
- mock(DistMetaDataPersistService.class), mockMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class),
+ mock(PersistService.class), mockMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class),
new ConfigurationProperties(new Properties()), mockOptimizeContextFactory());
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
index ca9a043..61d475e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMod
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.transaction.BackendTransactionManager;
@@ -94,7 +94,7 @@ public final class BackendConnectionTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), createMetaDataMap(),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), createMetaDataMap(),
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
TransactionContexts transactionContexts = createTransactionContexts();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
index a28de12..f75177a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMod
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.fixture.CallTimeRecordDataSource;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
@@ -70,7 +70,7 @@ public final class JDBCBackendDataSourceTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), createMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), createMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
TransactionContexts transactionContexts = createTransactionContexts();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
index 32c7efa..321a21d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
import org.junit.Before;
import org.junit.Test;
@@ -41,7 +41,7 @@ public final class BackendExecutorContextTest {
@Before
public void setUp() {
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), Collections.emptyMap(), mock(ShardingSphereRuleMetaData.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), Collections.emptyMap(), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java
index 0dc1bac..0f7dbec 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/ProxyContextTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
import org.junit.Test;
@@ -69,7 +69,7 @@ public final class ProxyContextTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
metaDataMap, mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
@@ -93,7 +93,7 @@ public final class ProxyContextTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
metaDataMap, mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
@@ -106,7 +106,7 @@ public final class ProxyContextTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
metaDataMap, mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
@@ -119,7 +119,7 @@ public final class ProxyContextTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
metaDataMap, mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseOperateBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseOperateBackendHandlerFactoryTest.java
index d18b1ea..2d0f416 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseOperateBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/DatabaseOperateBackendHandlerFactoryTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
@@ -61,7 +61,7 @@ public final class DatabaseOperateBackendHandlerFactoryTest {
@Before
public void setUp() throws IllegalAccessException, NoSuchFieldException {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
getMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
ProxyContext.getInstance().init(contextManager);
@@ -150,7 +150,7 @@ public final class DatabaseOperateBackendHandlerFactoryTest {
private void setGovernanceMetaDataContexts(final boolean isGovernance) {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = isGovernance ? mockMetaDataContexts() : new MetaDataContexts(mock(DistMetaDataPersistService.class));
+ MetaDataContexts metaDataContexts = isGovernance ? mockMetaDataContexts() : new MetaDataContexts(mock(PersistService.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
ProxyContext.getInstance().init(contextManager);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutorTest.java
index 447b1ff..efad6c3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutorTest.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.junit.Before;
@@ -60,7 +60,7 @@ public final class ShowDatabasesExecutorTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowTablesExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowTablesExecutorTest.java
index e83e83c..c43706d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowTablesExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowTablesExecutorTest.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTablesStatement;
@@ -57,7 +57,7 @@ public final class ShowTablesExecutorTest {
Map<String, ShardingSphereMetaData> metaDataMap = getMetaDataMap();
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
metaDataMap, mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/UseDatabaseExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/UseDatabaseExecutorTest.java
index 37ec5b9..c537026 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/UseDatabaseExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/UseDatabaseExecutorTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.UnknownDatabaseException;
@@ -60,7 +60,7 @@ public final class UseDatabaseExecutorTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
getMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/BroadcastDatabaseBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/BroadcastDatabaseBackendHandlerTest.java
index c440aaa..87d0b9c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/BroadcastDatabaseBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/BroadcastDatabaseBackendHandlerTest.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngineFactory;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -79,7 +79,7 @@ public final class BroadcastDatabaseBackendHandlerTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/SchemaAssignedDatabaseBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/SchemaAssignedDatabaseBackendHandlerTest.java
index 818386a..1c2a5e0 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/SchemaAssignedDatabaseBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/SchemaAssignedDatabaseBackendHandlerTest.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngineFactory;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -80,7 +80,7 @@ public final class SchemaAssignedDatabaseBackendHandlerTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/UnicastDatabaseBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/UnicastDatabaseBackendHandlerTest.java
index a7715ff..15eb4b4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/UnicastDatabaseBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/data/impl/UnicastDatabaseBackendHandlerTest.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine;
import org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngineFactory;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -80,7 +80,7 @@ public final class UnicastDatabaseBackendHandlerTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
index f3c4f06..9a18e13 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
@@ -67,7 +67,7 @@ public final class DistSQLBackendHandlerFactoryTest {
public void setUp() throws IllegalAccessException, NoSuchFieldException {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
@@ -180,7 +180,7 @@ public final class DistSQLBackendHandlerFactoryTest {
private void setContextManager(final boolean isGovernance) {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = isGovernance ? mockMetaDataContexts() : new MetaDataContexts(mock(DistMetaDataPersistService.class));
+ MetaDataContexts metaDataContexts = isGovernance ? mockMetaDataContexts() : new MetaDataContexts(mock(PersistService.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
ProxyContext.getInstance().init(contextManager);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/SetVariableBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/SetVariableBackendHandlerTest.java
index f64ba84..43541c8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/SetVariableBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/SetVariableBackendHandlerTest.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
@@ -63,7 +63,7 @@ public final class SetVariableBackendHandlerTest {
public void setUp() throws NoSuchFieldException, IllegalAccessException {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
getMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureClusterPersistRepository.java
similarity index 93%
rename from shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java
rename to shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureClusterPersistRepository.java
index 02f9323..7a224f5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureClusterPersistRepository.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.fixture;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-public final class FixtureRegistryCenterRepository implements RegistryCenterRepository {
+public final class FixtureClusterPersistRepository implements ClusterPersistRepository {
private static final Map<String, String> REGISTRY_DATA = new LinkedHashMap<>();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
similarity index 92%
rename from shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
rename to shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
index 3e21fd8..26549ef 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.proxy.fixture.FixtureRegistryCenterRepository
+org.apache.shardingsphere.proxy.fixture.FixtureClusterPersistRepository
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
index 18804b4..a734954 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/FrontDatabaseProtocolTypeFactoryTest.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.junit.Test;
@@ -51,7 +51,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
@Test
public void assertGetDatabaseTypeWhenThrowShardingSphereConfigurationException() {
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
Collections.emptyMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
setContextManager(metaDataContexts);
assertTrue(metaDataContexts.getMetaDataMap().isEmpty());
@@ -60,7 +60,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
@Test
public void assertGetDatabaseTypeInstanceOfMySQLDatabaseTypeFromMetaDataContextsSchemaName() {
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
mockMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
setContextManager(metaDataContexts);
assertFalse(metaDataContexts.getMetaDataMap().isEmpty());
@@ -76,7 +76,7 @@ public final class FrontDatabaseProtocolTypeFactoryTest {
public void assertGetDatabaseTypeOfPostgreSQLDatabaseTypeFromMetaDataContextsProps() {
Properties props = new Properties();
props.setProperty(ConfigurationPropertyKey.PROXY_FRONTEND_DATABASE_PROTOCOL_TYPE.getKey(), "PostgreSQL");
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
mockMetaDataMap(), mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(props), mock(OptimizeContextFactory.class));
setContextManager(metaDataContexts);
assertFalse(metaDataContexts.getMetaDataMap().isEmpty());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
index 504d1b8..e61d720 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
@@ -38,7 +38,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
@@ -168,7 +168,7 @@ public final class MySQLFrontendEngineTest {
}
private MetaDataContexts getMetaDataContexts(final ShardingSphereUser user) {
- return new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ return new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
buildGlobalRuleMetaData(user), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
index 4e6ad63..e170dac 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
@@ -34,7 +34,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
import org.junit.Before;
@@ -152,7 +152,7 @@ public final class MySQLAuthenticationEngineTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class),
Collections.singletonMap("sharding_db", mock(ShardingSphereMetaData.class)), mock(ShardingSphereRuleMetaData.class),
mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
index 1718635..b8c4b2d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
@@ -35,7 +35,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.junit.Before;
@@ -144,7 +144,7 @@ public final class MySQLAuthenticationHandlerTest {
}
private MetaDataContexts getMetaDataContexts(final ShardingSphereUser user) {
- return new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ return new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
buildGlobalRuleMetaData(user), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecutorFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecutorFactoryTest.java
index 0508543..1c86f93 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecutorFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandExecutorFactoryTest.java
@@ -35,7 +35,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
import org.apache.shardingsphere.infra.optimize.core.metadata.FederateSchemaMetadatas;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.frontend.mysql.command.admin.initdb.MySQLComInitDbExecutor;
@@ -81,7 +81,7 @@ public final class MySQLCommandExecutorFactoryTest {
ShardingSphereMetaData metaData = mockShardingSphereMetaData();
Map<String, ShardingSphereMetaData> metaDataMap = Collections.singletonMap("logic_db", metaData);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), metaDataMap,
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), metaDataMap,
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mockOptimizeContextFactory());
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
index 0aec1e5..20d3bdc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.exec
import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.execute.MySQLComStmtExecutePacket;
import org.apache.shardingsphere.infra.context.manager.ContextManager;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
@@ -67,7 +67,7 @@ public final class MySQLComStmtExecuteExecutorTest {
contextManagerField.setAccessible(true);
ShardingSphereMetaData metaData = mockMetaData();
Map<String, ShardingSphereMetaData> metaDataMap = Collections.singletonMap("logic_db", metaData);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), metaDataMap,
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), metaDataMap,
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mockOptimizeContextFactory());
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
index 330e6a0..4371200 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
@@ -36,7 +36,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.InvalidAuthorizationSpecificationException;
@@ -144,7 +144,7 @@ public final class PostgreSQLAuthenticationEngineTest {
}
private MetaDataContexts getMetaDataContexts(final ShardingSphereUser user) {
- return new MetaDataContexts(mock(DistMetaDataPersistService.class), new LinkedHashMap<>(),
+ return new MetaDataContexts(mock(PersistService.class), new LinkedHashMap<>(),
buildGlobalRuleMetaData(user), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
index 17f5216..c22d4f5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
@@ -39,7 +39,7 @@ import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.junit.Before;
import org.junit.Test;
@@ -130,7 +130,7 @@ public final class PostgreSQLAuthenticationHandlerTest {
}
private MetaDataContexts getMetaDataContexts(final ShardingSphereUser user) {
- return new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ return new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
buildGlobalRuleMetaData(user), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/parse/PostgreSQLComParseExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/parse/PostgreSQLComParseExecutorTest.java
index a0c39f9..4eecdf6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/parse/PostgreSQLComParseExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/parse/PostgreSQLComParseExecutorTest.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.infra.optimize.context.OptimizeContextFactory;
-import org.apache.shardingsphere.infra.persist.DistMetaDataPersistService;
+import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.EmptyStatement;
@@ -73,7 +73,7 @@ public final class PostgreSQLComParseExecutorTest {
Field contextManagerField = ProxyContext.getInstance().getClass().getDeclaredField("contextManager");
contextManagerField.setAccessible(true);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataContexts metaDataContexts = new MetaDataContexts(mock(DistMetaDataPersistService.class), getMetaDataMap(),
+ MetaDataContexts metaDataContexts = new MetaDataContexts(mock(PersistService.class), getMetaDataMap(),
mock(ShardingSphereRuleMetaData.class), mock(ExecutorEngine.class), new ConfigurationProperties(new Properties()), mock(OptimizeContextFactory.class));
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
contextManagerField.set(ProxyContext.getInstance(), contextManager);
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
index 5eb502c..cc307e4 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
import org.apache.shardingsphere.scaling.core.api.impl.GovernanceRepositoryAPIImpl;
@@ -130,7 +130,7 @@ public final class ScalingAPIFactory {
private static volatile GovernanceRepositoryAPI instance;
static {
- ShardingSphereServiceLoader.register(RegistryCenterRepository.class);
+ ShardingSphereServiceLoader.register(ClusterPersistRepository.class);
}
public static GovernanceRepositoryAPI getInstance() {
@@ -147,9 +147,9 @@ public final class ScalingAPIFactory {
private static GovernanceRepositoryAPI createGovernanceRepositoryAPI() {
checkServerConfig();
ClusterPersistRepositoryConfiguration repositoryConfig = (ClusterPersistRepositoryConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
- RegistryCenterRepository registryCenterRepository = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, repositoryConfig.getType(), repositoryConfig.getProps());
- registryCenterRepository.init(repositoryConfig);
- return new GovernanceRepositoryAPIImpl(registryCenterRepository);
+ ClusterPersistRepository repository = TypedSPIRegistry.getRegisteredService(ClusterPersistRepository.class, repositoryConfig.getType(), repositoryConfig.getProps());
+ repository.init(repositoryConfig);
+ return new GovernanceRepositoryAPIImpl(repository);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImpl.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImpl.java
index ff8915b..4f39cdb 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImpl.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImpl.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.scaling.core.api.impl;
import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import org.apache.shardingsphere.governance.repository.spi.ClusterPersistRepository;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import org.apache.shardingsphere.scaling.core.api.GovernanceRepositoryAPI;
import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
@@ -42,7 +42,7 @@ import java.util.Map;
@Slf4j
public final class GovernanceRepositoryAPIImpl implements GovernanceRepositoryAPI {
- private final RegistryCenterRepository repository;
+ private final ClusterPersistRepository repository;
@Override
public void persistJobProgress(final JobContext jobContext) {