Skip to content

Commit

Permalink
Move PersistService to mode module (apache#11991)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Aug 24, 2021
1 parent 506378b commit 80befaa
Show file tree
Hide file tree
Showing 68 changed files with 245 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<name>${project.artifactId}</name>

<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-mode-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-cluster-mode-repository-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.apache.shardingsphere.governance.core.registry.cache.event.StartScalingEvent;
import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationCachedEvent;
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.mode.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.mode.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.authority.api.config.AuthorityRuleConfiguration;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.governance.core.registry.state.service.UserStatusRegistryService;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.registry.config.watcher;

import com.google.common.base.Preconditions;
import org.apache.shardingsphere.infra.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.persist.node.GlobalNode;
import org.apache.shardingsphere.governance.core.registry.GovernanceWatcher;
import org.apache.shardingsphere.governance.core.registry.config.event.rule.GlobalRuleConfigurationsChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.shardingsphere.governance.core.registry.config.watcher;

import org.apache.shardingsphere.infra.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.persist.node.GlobalNode;
import org.apache.shardingsphere.governance.core.registry.GovernanceWatcher;
import org.apache.shardingsphere.governance.core.registry.config.event.props.PropertiesChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.mode.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationCachedEvent;
import org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsChangedEvent;
import org.apache.shardingsphere.governance.core.registry.config.event.schema.SchemaChangedEvent;
import org.apache.shardingsphere.infra.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.mode.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.governance.core.registry.metadata.event.SchemaAddedEvent;
import org.apache.shardingsphere.governance.core.registry.metadata.event.SchemaDeletedEvent;
import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlSchema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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.mode.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.registry.metadata.subscriber;

import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.mode.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.infra.database.DefaultSchema;
import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.mode.persist.PersistService;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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.persist.PersistService;
import org.apache.shardingsphere.mode.persist.PersistService;
import org.apache.shardingsphere.infra.state.StateContext;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.shardingsphere.infra.config.DatabaseAccessConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.mode.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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist;
package org.apache.shardingsphere.mode.persist;

import lombok.Getter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.infra.persist.service.impl.DataSourcePersistService;
import org.apache.shardingsphere.infra.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.infra.persist.service.impl.PropertiesPersistService;
import org.apache.shardingsphere.infra.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.mode.persist.service.SchemaMetaDataPersistService;
import org.apache.shardingsphere.mode.persist.service.impl.DataSourcePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.PropertiesPersistService;
import org.apache.shardingsphere.mode.persist.service.impl.SchemaRulePersistService;

import java.util.Collection;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.node;
package org.apache.shardingsphere.mode.persist.node;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.node;
package org.apache.shardingsphere.mode.persist.node;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service;
package org.apache.shardingsphere.mode.persist.service;

/**
* Global persist service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service;
package org.apache.shardingsphere.mode.persist.service;

/**
* Schema based persist service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service;
package org.apache.shardingsphere.mode.persist.service;

import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.mode.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service.impl;
package org.apache.shardingsphere.mode.persist.service.impl;

import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.mode.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.persist.service.SchemaBasedPersistService;
import org.apache.shardingsphere.mode.persist.service.SchemaBasedPersistService;
import org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service.impl;
package org.apache.shardingsphere.mode.persist.service.impl;

import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.persist.node.GlobalNode;
import org.apache.shardingsphere.infra.persist.service.GlobalPersistService;
import org.apache.shardingsphere.mode.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.persist.service.GlobalPersistService;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service.impl;
package org.apache.shardingsphere.mode.persist.service.impl;

import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.persist.node.GlobalNode;
import org.apache.shardingsphere.infra.persist.service.GlobalPersistService;
import org.apache.shardingsphere.mode.persist.node.GlobalNode;
import org.apache.shardingsphere.mode.persist.service.GlobalPersistService;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist.service.impl;
package org.apache.shardingsphere.mode.persist.service.impl;

import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.infra.persist.service.SchemaBasedPersistService;
import org.apache.shardingsphere.mode.persist.node.SchemaMetadataNode;
import org.apache.shardingsphere.mode.persist.service.SchemaBasedPersistService;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationCheckerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.shardingsphere.authority.api.config.AuthorityRuleConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.persist.PersistService;
import org.apache.shardingsphere.mode.persist.PersistService;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
import org.apache.shardingsphere.mode.metadata.fixture.FixtureRule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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.persist.PersistService;
import org.apache.shardingsphere.mode.persist.PersistService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* limitations under the License.
*/

package org.apache.shardingsphere.infra.persist;
package org.apache.shardingsphere.mode.persist;

import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
import org.apache.shardingsphere.infra.persist.service.impl.DataSourcePersistService;
import org.apache.shardingsphere.infra.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.infra.persist.service.impl.PropertiesPersistService;
import org.apache.shardingsphere.infra.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.DataSourcePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.GlobalRulePersistService;
import org.apache.shardingsphere.mode.persist.service.impl.PropertiesPersistService;
import org.apache.shardingsphere.mode.persist.service.impl.SchemaRulePersistService;
import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import org.apache.shardingsphere.test.mock.MockedDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.mode.persist.fixture;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.function.EnhancedRuleConfiguration;

@Getter
@Setter
public final class RuleConfigurationFixture implements RuleConfiguration, EnhancedRuleConfiguration {

private String name;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.mode.persist.fixture;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;

@Getter
@Setter
public final class YamlRuleConfigurationFixture implements YamlRuleConfiguration {

private String name;

@Override
public Class<RuleConfigurationFixture> getRuleConfigurationType() {
return RuleConfigurationFixture.class;
}
}
Loading

0 comments on commit 80befaa

Please sign in to comment.