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

[shardingsphere] branch master updated: Add new sharding rule configuration swapper (#25947)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f4564f821eb Add new sharding rule configuration swapper (#25947)
f4564f821eb is described below

commit f4564f821eb1d8c74a6c26b82a57769831d7af78
Author: ChenJiaHao <Pa...@163.com>
AuthorDate: Wed May 31 14:12:04 2023 +0800

    Add new sharding rule configuration swapper (#25947)
    
    * Add new sharding rule configuration swapper
    
    * Update rule path constant
    
    * Add rule not null checks
    
    * Remove ROOT_NODE in ShardingNodeConverter
    
    * Fix comments
---
 ...ReadwriteSplittingRuleConfigurationSwapper.java |   4 +-
 .../NewYamlShardingRuleConfigurationSwapper.java   | 141 ++++++++++++++++
 ...ewYamlShardingRuleConfigurationSwapperTest.java | 100 ++++++++++++
 .../config/sharding/ShardingNodeConverter.java     | 181 +++++++++++++++++++++
 4 files changed, 423 insertions(+), 3 deletions(-)

diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/NewYamlReadwriteSplittingRuleConfigurationSwapper.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/NewYamlReadwriteSplittingRuleConfigurationSwapper.java
index 3509b61a35e..07c79b052e1 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/NewYamlReadwriteSplittingRuleConfigurationSwapper.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/NewYamlReadwriteSplittingRuleConfigurationSwapper.java
@@ -35,9 +35,7 @@ import java.util.Map.Entry;
 /**
  * YAML readwrite-splitting rule configuration swapper.
  */
-public final class NewYamlReadwriteSplittingRuleConfigurationSwapper
-        implements
-            NewYamlRuleConfigurationSwapper<ReadwriteSplittingRuleConfiguration> {
+public final class NewYamlReadwriteSplittingRuleConfigurationSwapper implements NewYamlRuleConfigurationSwapper<ReadwriteSplittingRuleConfiguration> {
     
     private final ReadwriteSplittingNodeConverter converter = new ReadwriteSplittingNodeConverter();
     
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapper.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapper.java
new file mode 100644
index 00000000000..ad6700fea29
--- /dev/null
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapper.java
@@ -0,0 +1,141 @@
+/*
+ * 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.sharding.yaml.swapper;
+
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.YamlDataNode;
+import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
+import org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapper;
+import org.apache.shardingsphere.metadata.persist.node.metadata.config.sharding.ShardingNodeConverter;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.constant.ShardingOrder;
+import org.apache.shardingsphere.sharding.yaml.swapper.cache.YamlShardingCacheConfigurationSwapper;
+import org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingAutoTableRuleConfigurationSwapper;
+import org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableRuleConfigurationSwapper;
+import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlKeyGenerateStrategyConfigurationSwapper;
+import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingAuditStrategyConfigurationSwapper;
+import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingStrategyConfigurationSwapper;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Map.Entry;
+
+/**
+ * TODO Rename to NewYamlShardingRuleConfigurationSwapper when metadata structure adjustment completed. #25485
+ * New YAML sharding rule configuration swapper.
+ */
+public final class NewYamlShardingRuleConfigurationSwapper implements NewYamlRuleConfigurationSwapper<ShardingRuleConfiguration> {
+    
+    private final ShardingNodeConverter converter = new ShardingNodeConverter();
+    
+    private final YamlShardingTableRuleConfigurationSwapper tableSwapper = new YamlShardingTableRuleConfigurationSwapper();
+    
+    private final YamlShardingStrategyConfigurationSwapper shardingStrategySwapper = new YamlShardingStrategyConfigurationSwapper();
+    
+    private final YamlKeyGenerateStrategyConfigurationSwapper keyGenerateStrategySwapper = new YamlKeyGenerateStrategyConfigurationSwapper();
+    
+    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new YamlAlgorithmConfigurationSwapper();
+    
+    private final YamlShardingAuditStrategyConfigurationSwapper auditStrategySwapper = new YamlShardingAuditStrategyConfigurationSwapper();
+    
+    private final YamlShardingAutoTableRuleConfigurationSwapper autoTableYamlSwapper = new YamlShardingAutoTableRuleConfigurationSwapper();
+    
+    private final YamlShardingCacheConfigurationSwapper shardingCacheYamlSwapper = new YamlShardingCacheConfigurationSwapper();
+    
+    @Override
+    public Collection<YamlDataNode> swapToDataNodes(final ShardingRuleConfiguration data) {
+        Collection<YamlDataNode> result = new LinkedHashSet<>();
+        // TODO swap rule to YAML configuration before YamlEngine.marshal
+        swapTableRules(data, result);
+        swapStrategies(data, result);
+        swapAlgorithms(data, result);
+        if (null != data.getDefaultShardingColumn()) {
+            result.add(new YamlDataNode(converter.getDefaultShardingColumnPath(), YamlEngine.marshal(data.getDefaultShardingColumn())));
+        }
+        if (null != data.getShardingCache()) {
+            result.add(new YamlDataNode(converter.getShardingCachePath(), YamlEngine.marshal(data.getShardingCache())));
+        }
+        return result;
+    }
+    
+    private void swapTableRules(final ShardingRuleConfiguration data, final Collection<YamlDataNode> result) {
+        for (ShardingTableRuleConfiguration each : data.getTables()) {
+            result.add(new YamlDataNode(converter.getTableNamePath(each.getLogicTable()), YamlEngine.marshal(each)));
+        }
+        for (ShardingAutoTableRuleConfiguration each : data.getAutoTables()) {
+            result.add(new YamlDataNode(converter.getAutoTableNamePath(each.getLogicTable()), YamlEngine.marshal(each)));
+        }
+        for (ShardingTableReferenceRuleConfiguration each : data.getBindingTableGroups()) {
+            result.add(new YamlDataNode(converter.getBindingTableNamePath(each.getName()), YamlEngine.marshal(each)));
+        }
+        if (null != data.getBroadcastTables() && !data.getBroadcastTables().isEmpty()) {
+            result.add(new YamlDataNode(converter.getBroadcastTablesPath(), YamlEngine.marshal(data.getBroadcastTables())));
+        }
+    }
+    
+    private void swapStrategies(final ShardingRuleConfiguration data, final Collection<YamlDataNode> result) {
+        if (null != data.getDefaultDatabaseShardingStrategy()) {
+            result.add(new YamlDataNode(converter.getDefaultDatabaseStrategyPath(), YamlEngine.marshal(data.getDefaultDatabaseShardingStrategy())));
+        }
+        if (null != data.getDefaultTableShardingStrategy()) {
+            result.add(new YamlDataNode(converter.getDefaultTableStrategyPath(), YamlEngine.marshal(data.getDefaultTableShardingStrategy())));
+        }
+        if (null != data.getDefaultKeyGenerateStrategy()) {
+            result.add(new YamlDataNode(converter.getDefaultKeyGenerateStrategyPath(), YamlEngine.marshal(data.getDefaultKeyGenerateStrategy())));
+        }
+        if (null != data.getDefaultAuditStrategy()) {
+            result.add(new YamlDataNode(converter.getDefaultAuditStrategyPath(), YamlEngine.marshal(data.getDefaultAuditStrategy())));
+        }
+    }
+    
+    private void swapAlgorithms(final ShardingRuleConfiguration data, final Collection<YamlDataNode> result) {
+        for (Entry<String, AlgorithmConfiguration> each : data.getShardingAlgorithms().entrySet()) {
+            result.add(new YamlDataNode(converter.getShardingAlgorithmsPath(each.getKey()), YamlEngine.marshal(each.getValue())));
+        }
+        for (Entry<String, AlgorithmConfiguration> each : data.getKeyGenerators().entrySet()) {
+            result.add(new YamlDataNode(converter.getKeyGeneratorsPath(each.getKey()), YamlEngine.marshal(each.getValue())));
+        }
+        for (Entry<String, AlgorithmConfiguration> each : data.getAuditors().entrySet()) {
+            result.add(new YamlDataNode(converter.getAuditorsPath(each.getKey()), YamlEngine.marshal(each.getValue())));
+        }
+    }
+    
+    @Override
+    public ShardingRuleConfiguration swapToObject(final Collection<YamlDataNode> dataNodes) {
+        return new ShardingRuleConfiguration();
+    }
+    
+    @Override
+    public Class<ShardingRuleConfiguration> getTypeClass() {
+        return ShardingRuleConfiguration.class;
+    }
+    
+    @Override
+    public String getRuleTagName() {
+        return "SHARDING";
+    }
+    
+    @Override
+    public int getOrder() {
+        return ShardingOrder.ORDER;
+    }
+}
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
new file mode 100644
index 00000000000..16ae14d69f5
--- /dev/null
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.sharding.yaml.swapper;
+
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.infra.util.yaml.datanode.YamlDataNode;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class NewYamlShardingRuleConfigurationSwapperTest {
+    
+    private final NewYamlShardingRuleConfigurationSwapper swapper = new NewYamlShardingRuleConfigurationSwapper();
+    
+    @Test
+    void assertSwapEmptyConfigToDataNodes() {
+        ShardingRuleConfiguration config = new ShardingRuleConfiguration();
+        Collection<YamlDataNode> result = swapper.swapToDataNodes(config);
+        assertThat(result.size(), is(0));
+    }
+    
+    @Test
+    void assertSwapFullConfigToDataNodesEmpty() {
+        ShardingRuleConfiguration config = createMaximumShardingRule();
+        Collection<YamlDataNode> result = swapper.swapToDataNodes(config);
+        assertThat(result.size(), is(14));
+        Iterator<YamlDataNode> iterator = result.iterator();
+        assertThat(iterator.next().getKey(), is("tables/table_LOGIC_TABLE"));
+        assertThat(iterator.next().getKey(), is("tables/table_SUB_LOGIC_TABLE"));
+        assertThat(iterator.next().getKey(), is("binding_tables/binding_table_foo"));
+        assertThat(iterator.next().getKey(), is("broadcast_tables"));
+        assertThat(iterator.next().getKey(), is("default_strategy/default_database_strategy"));
+        assertThat(iterator.next().getKey(), is("default_strategy/default_table_strategy"));
+        assertThat(iterator.next().getKey(), is("default_strategy/default_key_generate_strategy"));
+        assertThat(iterator.next().getKey(), is("default_strategy/default_audit_strategy"));
+        assertThat(iterator.next().getKey(), is("sharding_algorithms/core_standard_fixture"));
+        assertThat(iterator.next().getKey(), is("key_generators/uuid"));
+        assertThat(iterator.next().getKey(), is("key_generators/default"));
+        assertThat(iterator.next().getKey(), is("key_generators/auto_increment"));
+        assertThat(iterator.next().getKey(), is("auditors/audit_algorithm"));
+        assertThat(iterator.next().getKey(), is("default_strategy/default_sharding_column"));
+    }
+    
+    private ShardingRuleConfiguration createMaximumShardingRule() {
+        ShardingRuleConfiguration result = new ShardingRuleConfiguration();
+        ShardingTableRuleConfiguration shardingTableRuleConfig = createTableRuleConfiguration("LOGIC_TABLE", "ds_${0..1}.table_${0..2}");
+        shardingTableRuleConfig.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "uuid"));
+        ShardingTableRuleConfiguration subTableRuleConfig = createTableRuleConfiguration("SUB_LOGIC_TABLE", "ds_${0..1}.sub_table_${0..2}");
+        subTableRuleConfig.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "auto_increment"));
+        result.getTables().add(shardingTableRuleConfig);
+        result.getTables().add(subTableRuleConfig);
+        result.getBindingTableGroups().add(new ShardingTableReferenceRuleConfiguration("foo", shardingTableRuleConfig.getLogicTable() + "," + subTableRuleConfig.getLogicTable()));
+        result.getBroadcastTables().add("BROADCAST_TABLE");
+        result.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("ds_id", "standard"));
+        result.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("table_id", "standard"));
+        result.setDefaultShardingColumn("table_id");
+        result.setDefaultKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "default"));
+        result.setDefaultAuditStrategy(new ShardingAuditStrategyConfiguration(Collections.singletonList("audit_algorithm"), false));
+        result.getShardingAlgorithms().put("core_standard_fixture", new AlgorithmConfiguration("CORE.STANDARD.FIXTURE", new Properties()));
+        result.getKeyGenerators().put("uuid", new AlgorithmConfiguration("UUID", new Properties()));
+        result.getKeyGenerators().put("default", new AlgorithmConfiguration("UUID", new Properties()));
+        result.getKeyGenerators().put("auto_increment", new AlgorithmConfiguration("AUTO_INCREMENT.FIXTURE", new Properties()));
+        result.getAuditors().put("audit_algorithm", new AlgorithmConfiguration("DML_SHARDING_CONDITIONS", new Properties()));
+        return result;
+    }
+    
+    private ShardingTableRuleConfiguration createTableRuleConfiguration(final String logicTableName, final String actualDataNodes) {
+        ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(logicTableName, actualDataNodes);
+        result.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("user_id", "database_inline"));
+        result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "table_inline"));
+        return result;
+    }
+}
diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/metadata/config/sharding/ShardingNodeConverter.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/metadata/config/sharding/ShardingNodeConverter.java
new file mode 100644
index 00000000000..3d2ffc255d7
--- /dev/null
+++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/metadata/config/sharding/ShardingNodeConverter.java
@@ -0,0 +1,181 @@
+/*
+ * 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.metadata.persist.node.metadata.config.sharding;
+
+/**
+ * Sharding node converter.
+ */
+public final class ShardingNodeConverter {
+    
+    private static final String TABLES = "tables";
+    
+    private static final String AUTO_TABLES = "auto_tables";
+    
+    private static final String BINDING_TABLES = "binding_tables";
+    
+    private static final String BROADCAST_TABLES = "broadcast_tables";
+    
+    private static final String DEFAULT_STRATEGY = "default_strategy";
+    
+    private static final String DEFAULT_DATABASE_STRATEGY = "default_database_strategy";
+    
+    private static final String DEFAULT_TABLE_STRATEGY = "default_table_strategy";
+    
+    private static final String DEFAULT_KEY_GENERATE_STRATEGY = "default_key_generate_strategy";
+    
+    private static final String DEFAULT_AUDIT_STRATEGY = "default_audit_strategy";
+    
+    private static final String DEFAULT_SHARDING_COLUMN = "default_sharding_column";
+    
+    private static final String SHARDING_ALGORITHMS = "sharding_algorithms";
+    
+    private static final String KEY_GENERATORS = "key_generators";
+    
+    private static final String AUDITORS = "auditors";
+    
+    private static final String SHARDING_CACHE = "sharding_cache";
+    
+    private static final String TABLE_NAME = "table_%s";
+    
+    private static final String AUTO_TABLE_NAME = "auto_table_%s";
+    
+    private static final String BINDING_TABLE_NAME = "binding_table_%s";
+    
+    /**
+     * Get table name path.
+     * 
+     * @param tableName table name
+     * @return table name path
+     */
+    public String getTableNamePath(final String tableName) {
+        return String.join("/", TABLES, String.format(TABLE_NAME, tableName));
+    }
+    
+    /**
+     * Get auto table name path.
+     * 
+     * @param tableName table name
+     * @return auto table name path
+     */
+    public String getAutoTableNamePath(final String tableName) {
+        return String.join("/", AUTO_TABLES, String.format(AUTO_TABLE_NAME, tableName));
+    }
+    
+    /**
+     * Get binding table name path.
+     * 
+     * @param tableName table name
+     * @return binding table name path
+     */
+    public String getBindingTableNamePath(final String tableName) {
+        return String.join("/", BINDING_TABLES, String.format(BINDING_TABLE_NAME, tableName));
+    }
+    
+    /**
+     * Get broadcast tables path.
+     * 
+     * @return broadcast tables path
+     */
+    public String getBroadcastTablesPath() {
+        return String.join("/", BROADCAST_TABLES);
+    }
+    
+    /**
+     * Get default database strategy path.
+     * 
+     * @return default database strategy path
+     */
+    public String getDefaultDatabaseStrategyPath() {
+        return String.join("/", DEFAULT_STRATEGY, DEFAULT_DATABASE_STRATEGY);
+    }
+    
+    /**
+     * Get default table strategy path.
+     * 
+     * @return default table strategy path
+     */
+    public String getDefaultTableStrategyPath() {
+        return String.join("/", DEFAULT_STRATEGY, DEFAULT_TABLE_STRATEGY);
+    }
+    
+    /**
+     * Get default key generate strategy path.
+     * 
+     * @return default key generate path
+     */
+    public String getDefaultKeyGenerateStrategyPath() {
+        return String.join("/", DEFAULT_STRATEGY, DEFAULT_KEY_GENERATE_STRATEGY);
+    }
+    
+    /**
+     * Get default audit strategy path.
+     * 
+     * @return default audit strategy path
+     */
+    public String getDefaultAuditStrategyPath() {
+        return String.join("/", DEFAULT_STRATEGY, DEFAULT_AUDIT_STRATEGY);
+    }
+    
+    /**
+     * Get default sharding column path.
+     * 
+     * @return default sharding column path
+     */
+    public String getDefaultShardingColumnPath() {
+        return String.join("/", DEFAULT_STRATEGY, DEFAULT_SHARDING_COLUMN);
+    }
+    
+    /**
+     * Get sharding algorithm name path.
+     *
+     * @param shardingAlgorithmName sharding algorithm name
+     * @return sharding algorithm name path
+     */
+    public String getShardingAlgorithmsPath(final String shardingAlgorithmName) {
+        return String.join("/", SHARDING_ALGORITHMS, shardingAlgorithmName);
+    }
+    
+    /**
+     * Get key generator name path.
+     *
+     * @param keyGeneratorName key generator name
+     * @return key generator name path
+     */
+    public String getKeyGeneratorsPath(final String keyGeneratorName) {
+        return String.join("/", KEY_GENERATORS, keyGeneratorName);
+    }
+    
+    /**
+     * Get auditor name path.
+     *
+     * @param auditorName auditor name
+     * @return auditor name path
+     */
+    public String getAuditorsPath(final String auditorName) {
+        return String.join("/", AUDITORS, auditorName);
+    }
+    
+    /**
+     * Get sharding cache path.
+     *
+     * @return sharding cache path
+     */
+    public String getShardingCachePath() {
+        return String.join("/", SHARDING_CACHE);
+    }
+}