Pochatkin commented on code in PR #2194:
URL: https://github.com/apache/ignite-3/pull/2194#discussion_r1235339202


##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/ClusterEventCallback.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.internal.deployunit.metastore;
+
+import 
org.apache.ignite.internal.deployunit.metastore.status.UnitClusterStatus;
+
+/**
+ * Listener of deployment unit cluster status changes.
+ */
+public interface ClusterEventCallback {

Review Comment:
   NodeEventCallback is abstract class but this one still interface. Maybe you 
will create general class with T extends NodeStatus?



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/ClusterEventCallbackImpl.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.internal.deployunit.metastore;
+
+import static 
org.apache.ignite.internal.rest.api.deployment.DeploymentStatus.REMOVING;
+
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.ignite.compute.version.Version;
+import 
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
+import org.apache.ignite.internal.cluster.management.topology.api.LogicalNode;
+import org.apache.ignite.internal.deployunit.FileDeployerService;
+import 
org.apache.ignite.internal.deployunit.metastore.status.UnitClusterStatus;
+
+/** Listener of deployment unit cluster status changes. */
+public class ClusterEventCallbackImpl implements ClusterEventCallback {
+    private final DeploymentUnitStore deploymentUnitStore;
+    private final FileDeployerService deployerService;
+    private final ClusterManagementGroupManager cmgManager;
+    private final String nodeName;

Review Comment:
   Add empty lines



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java:
##########
@@ -182,31 +195,46 @@ public CompletableFuture<List<String>> getAllNodes(String 
id, Version version) {
     }
 
     @Override
-    public CompletableFuture<Boolean> remove(String id, Version version) {
+    public CompletableFuture<List<UnitNodeStatus>> getAllNodeStatuses(String 
id, Version version) {
+        CompletableFuture<List<UnitNodeStatus>> result = new 
CompletableFuture<>();
+        ByteArray nodes = 
NodeStatusKey.builder().id(id).version(version).build().toByteArray();
+        metaStorage.prefix(nodes).subscribe(new 
NodeStatusAccumulator().toSubscriber(result));
+        return result;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> removeClusterStatus(String id, Version 
version) {
         ByteArray key = 
ClusterStatusKey.builder().id(id).version(version).build().toByteArray();
+
+        return metaStorage.invoke(exists(key), Operations.remove(key), noop());
+    }
+
+    @Override
+    public CompletableFuture<Boolean> removeNodeStatus(String nodeId, String 
id, Version version) {
+        ByteArray key = 
NodeStatusKey.builder().id(id).version(version).nodeId(nodeId).build().toByteArray();

Review Comment:
   This is full key, you don't need to use prefix here, just get is enough



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStore.java:
##########
@@ -153,12 +174,23 @@ default CompletableFuture<Boolean> 
createNodeStatus(String nodeId, String id, Ve
      */
     CompletableFuture<List<String>> getAllNodes(String id, Version version);
 
+    /**
+     * Returns a list of node statuses where unit with provided identifier and 
version is deployed.
+     *
+     * @param id Deployment unit identifier.
+     * @param version Deployment unit version.
+     * @return A list of node statuses where unit with provided identifier and 
version is deployed or empty list.
+     */
+    CompletableFuture<List<UnitNodeStatus>> getAllNodeStatuses(String id, 
Version version);
+
     /**
      * Removes all data for deployment unit.
      *
      * @param id Deployment unit identifier.
      * @param version Deployment version identifier.
      * @return Future with {@code true} result if removed successfully.
      */
-    CompletableFuture<Boolean> remove(String id, Version version);
+    CompletableFuture<Boolean> removeClusterStatus(String id, Version version);
+
+    CompletableFuture<Boolean> removeNodeStatus(String nodeId, String id, 
Version version);

Review Comment:
   Javadoc



-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

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

Reply via email to