You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/01/20 15:36:30 UTC

[GitHub] [ignite-3] akalash commented on a change in pull request #14: IGNITE-13836 First implementation of multi-root support for independent modules configurations

akalash commented on a change in pull request #14:
URL: https://github.com/apache/ignite-3/pull/14#discussion_r561038584



##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/SystemConfiguration.java
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.ignite.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.configuration.internal.DynamicConfiguration;
+import org.apache.ignite.configuration.presentation.json.JsonPresentation;
+
+/** */
+public class SystemConfiguration {
+    /** */
+    private final Map<String, Configurator<?>> configs = new HashMap<>();
+
+    /** */
+    private final Map<String, ConfigurationTree<?, ?>> multirootConfiguration = new HashMap<>();
+
+    /** */
+    private final ConfigurationPresentation<String> presentation = new JsonPresentation(configs);
+
+    /** */
+    public <T extends DynamicConfiguration<?, ?, ?>> void registerConfigurator(Configurator<T> unitConfig) {
+        String key = unitConfig.getRoot().key();
+
+        configs.put(key, unitConfig);
+
+        multirootConfiguration.put(key, unitConfig.getRoot());
+    }
+
+    /** */
+    public <V, C, T extends ConfigurationTree<V, C>> T getConfiguration(RootKey<T> rootKey) {
+        return (T) multirootConfiguration.get(rootKey.key());
+    }
+
+    /** */
+    public ConfigurationPresentation<String> presentation() {

Review comment:
       Move to rest module?

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/SystemConfiguration.java
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.ignite.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.configuration.internal.DynamicConfiguration;
+import org.apache.ignite.configuration.presentation.json.JsonPresentation;
+
+/** */
+public class SystemConfiguration {

Review comment:
       As I remember we thought about renaming it to something like ConfiguratorRegistry

##########
File path: modules/configuration/pom.xml
##########
@@ -40,6 +40,12 @@
             <version>2.0.1.Final</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.6</version>
+        </dependency>

Review comment:
       Move to rest module?

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/Configurator.java
##########
@@ -118,6 +120,21 @@
         return selector.select(root).value();
     }
 
+    /**
+     * 
+     */
+    public <CHANGE> Class<CHANGE> getChangeType() {

Review comment:
       Maybe we should think about it. Instead of sharing the type, we can have a specific method 'set' with the raw key-value as input parameters. But I don't sure.

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/SystemConfiguration.java
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.ignite.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.configuration.internal.DynamicConfiguration;
+import org.apache.ignite.configuration.presentation.json.JsonPresentation;
+
+/** */
+public class SystemConfiguration {
+    /** */
+    private final Map<String, Configurator<?>> configs = new HashMap<>();
+
+    /** */
+    private final Map<String, ConfigurationTree<?, ?>> multirootConfiguration = new HashMap<>();
+
+    /** */
+    private final ConfigurationPresentation<String> presentation = new JsonPresentation(configs);
+
+    /** */
+    public <T extends DynamicConfiguration<?, ?, ?>> void registerConfigurator(Configurator<T> unitConfig) {
+        String key = unitConfig.getRoot().key();
+
+        configs.put(key, unitConfig);
+
+        multirootConfiguration.put(key, unitConfig.getRoot());
+    }
+
+    /** */
+    public <V, C, T extends ConfigurationTree<V, C>> T getConfiguration(RootKey<T> rootKey) {

Review comment:
       If we are going to implement a configuration class per root then this method is not longer needed

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/RootKey.java
##########
@@ -0,0 +1,24 @@
+/*
+ * 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.ignite.configuration;
+
+/** */
+public interface RootKey<T extends ConfigurationTree<?, ?>> {

Review comment:
       If we are going to implement a configuration class per root then rootKey will not need anymore.

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/presentation/FormatConverter.java
##########
@@ -27,6 +27,9 @@
     /** */

Review comment:
       Move whole class to rests module?

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/presentation/json/JsonConverter.java
##########
@@ -22,6 +22,7 @@
 import com.google.gson.Gson;

Review comment:
       Move whole class to rest?

##########
File path: modules/configuration/src/main/java/org/apache/ignite/configuration/presentation/json/JsonPresentation.java
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.ignite.configuration.presentation.json;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.apache.ignite.configuration.ConfigurationPresentation;
+import org.apache.ignite.configuration.ConfigurationProperty;
+import org.apache.ignite.configuration.Configurator;
+import org.apache.ignite.configuration.internal.DynamicConfiguration;
+import org.apache.ignite.configuration.internal.selector.BaseSelectors;
+
+/** */
+public class JsonPresentation implements ConfigurationPresentation<String> {

Review comment:
       Move whole class to rest moduel?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org