You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "Pochatkin (via GitHub)" <gi...@apache.org> on 2023/05/29 12:58:02 UTC

[GitHub] [ignite-3] Pochatkin commented on a diff in pull request #2102: IGNITE-19476 On demand deploy units API

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


##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/DeploymentUnitStoreImpl.java:
##########
@@ -166,35 +231,74 @@ private static Collection<Operation> removeAll(ByteArray key, List<byte[]> keys)
      * Update deployment unit meta.
      *
      * @param key Status key.
-     * @param status Deployment unit meta transformer.
+     * @param mapper Status map function.
+     * @param force Force update.
      * @return Future with update result.
      */
-    private CompletableFuture<Boolean> updateStatus(ByteArray key, DeploymentStatus status) {
+    private CompletableFuture<Boolean> updateStatus(ByteArray key, Function<byte[], byte[]> mapper, boolean force) {
         return metaStorage.get(key)
                 .thenCompose(e -> {
-                    if (e.value() == null) {
+                    byte[] value = e.value();
+                    if (value == null) {
                         return completedFuture(false);
                     }
-                    UnitStatus prev = deserialize(e.value());
+                    byte[] newValue = mapper.apply(value);
+
 
-                    if (status.compareTo(prev.status()) <= 0) {
+                    if (newValue == null) {
                         return completedFuture(false);
                     }
 
-                    prev.updateStatus(status);
-
-                    boolean force = status == DeploymentStatus.OBSOLETE;
-
                     return metaStorage.invoke(
                                     force ? exists(key) : revision(key).le(e.revision()),
-                                    put(key, serialize(prev)),
+                                    put(key, newValue),
                                     noop())
                             .thenCompose(finished -> {
                                 if (!finished && !force) {
-                                    return updateStatus(key, status);
+                                    return updateStatus(key, mapper, false);
                                 }
                                 return completedFuture(finished);
                             });
                 });
     }
+
+    private class NodeEventsListener implements WatchListener {

Review Comment:
   I don't want to share Executor instance



-- 
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-unsubscribe@ignite.apache.org

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