ptupitsyn commented on code in PR #1698:
URL: https://github.com/apache/ignite-3/pull/1698#discussion_r1119624265


##########
modules/api/src/main/java/org/apache/ignite/deployment/version/UnitVersion.java:
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.deployment.version;
+
+/**
+ * Implementation of {@link Version} interface based on the three numbers 
format,
+ * like x.x.x. where x is short number.
+ */
+public class UnitVersion implements Version {
+    private final short major;
+    private final short minor;
+    private final short patch;
+
+    /**
+     * Constructor.
+     *
+     * @param major Major part of version.
+     * @param minor Minor part of version.
+     * @param patch Patch part of version.
+     */
+    public UnitVersion(short major, short minor, short patch) {
+        this.major = major;
+        this.minor = minor;
+        this.patch = patch;
+    }
+
+    @Override
+    public String render() {
+        return major + "." + minor + "." + patch;
+    }
+
+    /**
+     * Parse string representation of version to {@link UnitVersion} if 
possible.
+     *
+     * @param s String representation of version.
+     * @return Instance of {@link UnitVersion}.
+     * @throws VersionParseException in case when string is not required 
{@link UnitVersion} format.
+     */
+    public static UnitVersion parse(String s) {

Review Comment:
   Missing null arg validation.



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java:
##########
@@ -0,0 +1,435 @@
+/*
+ * 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;
+
+import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.SYNC;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.exists;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.notExists;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.revision;
+import static org.apache.ignite.internal.metastorage.dsl.Operations.put;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Flow.Subscriber;
+import java.util.concurrent.Flow.Subscription;
+import java.util.stream.Collectors;
+import org.apache.ignite.deployment.DeploymentUnit;
+import org.apache.ignite.deployment.IgniteDeployment;
+import org.apache.ignite.deployment.UnitStatus;
+import org.apache.ignite.deployment.UnitStatus.UnitStatusBuilder;
+import org.apache.ignite.deployment.version.Version;
+import 
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
+import 
org.apache.ignite.internal.deployunit.configuration.DeploymentConfiguration;
+import 
org.apache.ignite.internal.deployunit.exception.DeployUnitWriteMetaException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitIdentifierException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitNotExistException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitReadException;
+import 
org.apache.ignite.internal.deployunit.exception.UndeployNotExistedDeploymentUnitException;
+import org.apache.ignite.internal.deployunit.message.DeployUnitMessageTypes;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequest;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequestBuilder;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequestImpl;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponse;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponseBuilder;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponseImpl;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitRequest;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitRequestImpl;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitResponse;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitResponseImpl;
+import org.apache.ignite.internal.future.InFlightFutures;
+import org.apache.ignite.internal.logger.IgniteLogger;
+import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.metastorage.Entry;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.dsl.Operation;
+import org.apache.ignite.internal.metastorage.dsl.Operations;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.lang.ByteArray;
+import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.ClusterService;
+
+//TODO: rework metastorage keys IGNITE-18870
+/**
+ * Deployment manager implementation.
+ */
+public class DeploymentManagerImpl implements IgniteDeployment, 
IgniteComponent {
+
+    private static final IgniteLogger LOG = 
Loggers.forClass(DeploymentManagerImpl.class);
+
+    private static final String TMP_SUFFIX = ".tmp";
+
+    private static final String DEPLOY_UNIT_PREFIX = "deploy-unit.";
+
+    private static final String UNITS_PREFIX = DEPLOY_UNIT_PREFIX + "units.";
+
+    /**
+     * Meta storage.
+     */
+    private final MetaStorageManager metaStorage;
+
+    /**
+     * Deployment configuration.
+     */
+    private final DeploymentConfiguration configuration;
+
+    /**
+     * Cluster management group manager.
+     */
+    private final ClusterManagementGroupManager cmgManager;
+
+    /**
+     * In flight futures tracker.
+     */
+    private final InFlightFutures inFlightFutures = new InFlightFutures();
+
+    /**
+     * Cluster service.
+     */
+    private final ClusterService clusterService;
+
+    /**
+     * Folder for units.
+     */
+    private Path unitsFolder;
+
+    /**
+     * Constructor.
+     *
+     * @param clusterService Cluster service.
+     * @param metaStorage Meta storage.
+     * @param workDir Node working directory.
+     * @param configuration Deployment configuration.
+     * @param cmgManager Cluster management group manager.
+     */
+    public DeploymentManagerImpl(ClusterService clusterService,
+            MetaStorageManager metaStorage,
+            Path workDir,
+            DeploymentConfiguration configuration,
+            ClusterManagementGroupManager cmgManager) {
+        this.clusterService = clusterService;
+        this.metaStorage = metaStorage;
+        this.configuration = configuration;
+        this.cmgManager = cmgManager;
+        unitsFolder = workDir;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> deployAsync(String id, Version version, 
DeploymentUnit deploymentUnit) {
+        if (id == null || id.isBlank() || version == null) {
+            return CompletableFuture.failedFuture(
+                    new DeploymentUnitIdentifierException("Empty identifier or 
version detected"));
+        }
+
+        ByteArray key = new ByteArray(UNITS_PREFIX + id + ":" + 
version.render());
+
+        UnitMeta meta = new UnitMeta(id, version, deploymentUnit.name(), 
Collections.emptyList());
+
+        Operation put = put(key, UnitMetaSerializer.serialize(meta));
+
+        DeployUnitRequestBuilder builder = DeployUnitRequestImpl.builder();
+
+        try {
+            builder.unitContent(deploymentUnit.content().readAllBytes());
+        } catch (IOException e) {
+            LOG.error("Error to read deployment unit content", e);
+            return CompletableFuture.failedFuture(new 
DeploymentUnitReadException(e));
+        }
+        DeployUnitRequest request = builder
+                .unitName(deploymentUnit.name())
+                .id(id)
+                .version(version.render())
+                .build();
+
+        return metaStorage.invoke(notExists(key), put, Operations.noop())
+                .thenCompose(success -> {
+                    if (success) {
+                        return doDeploy(request);
+                    }
+                    LOG.error("Failed to deploy meta of unit " + id + ":" + 
version);
+                    return CompletableFuture.failedFuture(new 
DeployUnitWriteMetaException());
+                })
+                .thenApply(completed -> {
+                    if (completed) {
+                        startDeployAsyncToCmg(request);
+                    }
+                    return completed;
+                });
+    }
+
+    private void startDeployAsyncToCmg(DeployUnitRequest request) {
+        cmgManager.cmgNodes()
+                .thenAccept(nodes -> {
+                    for (String node : nodes) {
+                        ClusterNode clusterNode = 
clusterService.topologyService().getByConsistentId(node);
+                        if (clusterNode != null) {
+                            
inFlightFutures.registerFuture(requestDeploy(clusterNode, request));
+                        }
+                    }
+                });
+    }
+
+    private CompletableFuture<Boolean> requestDeploy(ClusterNode clusterNode, 
DeployUnitRequest request) {
+        return clusterService.messagingService()
+                .invoke(clusterNode, request, Long.MAX_VALUE)
+                .thenCompose(message -> {
+                    Throwable error = ((DeployUnitResponse) message).error();
+                    if (error != null) {
+                        LOG.error("Failed to deploy unit " + request.id() + 
":" + request.version()
+                                + " to node " + clusterNode, error);
+                        return CompletableFuture.failedFuture(error);
+                    }
+                    return CompletableFuture.completedFuture(true);
+                });
+    }
+
+    @Override
+    public CompletableFuture<Void> undeployAsync(String id, Version version) {
+        if (id == null || id.isBlank() || version == null) {

Review Comment:
   Same as above: use `IllegalArgumentException`, separate check for every 
argument.



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/UnitMeta.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.deployment.version.Version;
+
+/**
+ * Unit meta data class.
+ */
+public class UnitMeta {
+    /**
+     * Unit id.
+     */
+    private final String id;
+
+    /**
+     * Unit version.
+     */
+    private final Version version;
+
+    /**
+     * Unit name.
+     */
+    private final String unitName;
+
+    /**
+     * Consistent ids of nodes with.
+     */
+    private final List<String> consistentIdLocation = new ArrayList<>();
+
+    /**
+     * Constructor.
+     *
+     * @param id Unit identifier.
+     * @param version Unit version.
+     * @param unitName Unit name.
+     * @param consistentIdLocation Consistent ids of nodes where unit deployed.
+     */
+    public UnitMeta(String id, Version version, String unitName, List<String> 
consistentIdLocation) {
+        this.id = id;
+        this.version = version;
+        this.unitName = unitName;
+        this.consistentIdLocation.addAll(consistentIdLocation);
+    }
+
+    public UnitMeta(String id, String unitName, List<String> 
consistentIdLocation) {
+        this(id, Version.LATEST, unitName, consistentIdLocation);
+    }
+
+    /**
+     * Returns identifier of deployment unit.
+     *
+     * @return Identifier of deployment unit.
+     */
+    public String getId() {

Review Comment:
   Here and below: remove `get` prefix from getters. All other APIs don't have 
them (e.g. `Table.name()`, `ColumnMetadata.type()`).



##########
modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java:
##########
@@ -390,4 +390,44 @@ public static class NodeConfiguration {
          */
         public static final int CONFIG_WRITE_ERR = 
NODE_CONFIGURATION_ERR_GROUP.registerErrorCode(3);
     }
+
+    /**
+     * Code deployment error group.
+     */
+    public static class CodeDeployment {
+        /**
+         * Code deployment error group.
+         */
+        public static final ErrorGroup CODE_DEPLOYMENT_ERR_GROUP = 
ErrorGroup.newGroup("CODEDEPLOY", 13);
+
+        /**
+         * Config read error.
+         */
+        public static final int UNDEPLOY_NOT_EXISTED_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(1);

Review Comment:
   ```suggestion
           public static final int UNDEPLOY_NON_EXISTING_UNIT_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(1);
   ```
   
   "Not existed" is not valid English (except "has not existed", but that's not 
what we want here).



##########
modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java:
##########
@@ -390,4 +390,44 @@ public static class NodeConfiguration {
          */
         public static final int CONFIG_WRITE_ERR = 
NODE_CONFIGURATION_ERR_GROUP.registerErrorCode(3);
     }
+
+    /**
+     * Code deployment error group.
+     */
+    public static class CodeDeployment {
+        /**
+         * Code deployment error group.
+         */
+        public static final ErrorGroup CODE_DEPLOYMENT_ERR_GROUP = 
ErrorGroup.newGroup("CODEDEPLOY", 13);
+
+        /**
+         * Config read error.

Review Comment:
   Seems to be misleading.



##########
modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java:
##########
@@ -390,4 +390,44 @@ public static class NodeConfiguration {
          */
         public static final int CONFIG_WRITE_ERR = 
NODE_CONFIGURATION_ERR_GROUP.registerErrorCode(3);
     }
+
+    /**
+     * Code deployment error group.
+     */
+    public static class CodeDeployment {
+        /**
+         * Code deployment error group.
+         */
+        public static final ErrorGroup CODE_DEPLOYMENT_ERR_GROUP = 
ErrorGroup.newGroup("CODEDEPLOY", 13);
+
+        /**
+         * Config read error.
+         */
+        public static final int UNDEPLOY_NOT_EXISTED_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(1);

Review Comment:
   Can we remove this error and use `UNIT_NOT_FOUND_ERR` below when someone 
tries to undeploy a unit that does not exist?



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java:
##########
@@ -0,0 +1,435 @@
+/*
+ * 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;
+
+import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.SYNC;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.exists;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.notExists;
+import static org.apache.ignite.internal.metastorage.dsl.Conditions.revision;
+import static org.apache.ignite.internal.metastorage.dsl.Operations.put;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Flow.Subscriber;
+import java.util.concurrent.Flow.Subscription;
+import java.util.stream.Collectors;
+import org.apache.ignite.deployment.DeploymentUnit;
+import org.apache.ignite.deployment.IgniteDeployment;
+import org.apache.ignite.deployment.UnitStatus;
+import org.apache.ignite.deployment.UnitStatus.UnitStatusBuilder;
+import org.apache.ignite.deployment.version.Version;
+import 
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
+import 
org.apache.ignite.internal.deployunit.configuration.DeploymentConfiguration;
+import 
org.apache.ignite.internal.deployunit.exception.DeployUnitWriteMetaException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitIdentifierException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitNotExistException;
+import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitReadException;
+import 
org.apache.ignite.internal.deployunit.exception.UndeployNotExistedDeploymentUnitException;
+import org.apache.ignite.internal.deployunit.message.DeployUnitMessageTypes;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequest;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequestBuilder;
+import org.apache.ignite.internal.deployunit.message.DeployUnitRequestImpl;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponse;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponseBuilder;
+import org.apache.ignite.internal.deployunit.message.DeployUnitResponseImpl;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitRequest;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitRequestImpl;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitResponse;
+import org.apache.ignite.internal.deployunit.message.UndeployUnitResponseImpl;
+import org.apache.ignite.internal.future.InFlightFutures;
+import org.apache.ignite.internal.logger.IgniteLogger;
+import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.metastorage.Entry;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.dsl.Operation;
+import org.apache.ignite.internal.metastorage.dsl.Operations;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.lang.ByteArray;
+import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.ClusterService;
+
+//TODO: rework metastorage keys IGNITE-18870
+/**
+ * Deployment manager implementation.
+ */
+public class DeploymentManagerImpl implements IgniteDeployment, 
IgniteComponent {
+
+    private static final IgniteLogger LOG = 
Loggers.forClass(DeploymentManagerImpl.class);
+
+    private static final String TMP_SUFFIX = ".tmp";
+
+    private static final String DEPLOY_UNIT_PREFIX = "deploy-unit.";
+
+    private static final String UNITS_PREFIX = DEPLOY_UNIT_PREFIX + "units.";
+
+    /**
+     * Meta storage.
+     */
+    private final MetaStorageManager metaStorage;
+
+    /**
+     * Deployment configuration.
+     */
+    private final DeploymentConfiguration configuration;
+
+    /**
+     * Cluster management group manager.
+     */
+    private final ClusterManagementGroupManager cmgManager;
+
+    /**
+     * In flight futures tracker.
+     */
+    private final InFlightFutures inFlightFutures = new InFlightFutures();
+
+    /**
+     * Cluster service.
+     */
+    private final ClusterService clusterService;
+
+    /**
+     * Folder for units.
+     */
+    private Path unitsFolder;
+
+    /**
+     * Constructor.
+     *
+     * @param clusterService Cluster service.
+     * @param metaStorage Meta storage.
+     * @param workDir Node working directory.
+     * @param configuration Deployment configuration.
+     * @param cmgManager Cluster management group manager.
+     */
+    public DeploymentManagerImpl(ClusterService clusterService,
+            MetaStorageManager metaStorage,
+            Path workDir,
+            DeploymentConfiguration configuration,
+            ClusterManagementGroupManager cmgManager) {
+        this.clusterService = clusterService;
+        this.metaStorage = metaStorage;
+        this.configuration = configuration;
+        this.cmgManager = cmgManager;
+        unitsFolder = workDir;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> deployAsync(String id, Version version, 
DeploymentUnit deploymentUnit) {
+        if (id == null || id.isBlank() || version == null) {

Review Comment:
   1. Let's check every argument separately and throw 
`IllegalArgumentException` directly. I don't think it should be wrapped into a 
future.
   
   2. `deploymentUnit` check is missing.



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/exception/DeploymentUnitIdentifierException.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.exception;
+
+import static 
org.apache.ignite.lang.ErrorGroups.CodeDeployment.UNIT_INVALID_IDENTIFIER_ERR;
+
+import org.apache.ignite.lang.IgniteException;
+
+/**
+ * Throws when deployment unit have invalid identifier or version.
+ */
+public class DeploymentUnitIdentifierException extends IgniteException {

Review Comment:
   I propose to remove this class. `IllegalArgumentException` is enough to 
indicate null or empty id.



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/UnitMeta.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.deployment.version.Version;
+
+/**
+ * Unit meta data class.
+ */
+public class UnitMeta {
+    /**
+     * Unit id.
+     */
+    private final String id;
+
+    /**
+     * Unit version.
+     */
+    private final Version version;
+
+    /**
+     * Unit name.
+     */
+    private final String unitName;

Review Comment:
   ```suggestion
       private final String name;
   ```
   
   Above we have `id` and `version`, not `unitId` and `unitVersion`, let's be 
consistent.



##########
modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java:
##########
@@ -390,4 +390,44 @@ public static class NodeConfiguration {
          */
         public static final int CONFIG_WRITE_ERR = 
NODE_CONFIGURATION_ERR_GROUP.registerErrorCode(3);
     }
+
+    /**
+     * Code deployment error group.
+     */
+    public static class CodeDeployment {
+        /**
+         * Code deployment error group.
+         */
+        public static final ErrorGroup CODE_DEPLOYMENT_ERR_GROUP = 
ErrorGroup.newGroup("CODEDEPLOY", 13);
+
+        /**
+         * Config read error.
+         */
+        public static final int UNDEPLOY_NOT_EXISTED_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(1);
+
+        /**
+         * Unit duplicate error.
+         */
+        public static final int DUPLICATE_DEPLOY_UNIT_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(2);
+
+        /**
+         * Access to not existed deployment unit.
+         */
+        public static final int NOT_EXISTED_UNIT_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(3);

Review Comment:
   ```suggestion
           public static final int UNIT_NOT_FOUND_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(3);
   ```
   
   (to be consistent with `TABLE_NOT_FOUND_ERR`, `COLUMN_NOT_FOUND_ERR`)



##########
modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/exception/DeploymentUnitNotExistException.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.exception;
+
+import org.apache.ignite.lang.ErrorGroups.CodeDeployment;
+import org.apache.ignite.lang.IgniteException;
+
+/**
+ * Throws when trying to access information about unit which doesn't exist.
+ */
+public class DeploymentUnitNotExistException extends IgniteException {

Review Comment:
   ```suggestion
   public class DeploymentUnitDoesNotExistException extends IgniteException {
   ```



##########
modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java:
##########
@@ -390,4 +390,44 @@ public static class NodeConfiguration {
          */
         public static final int CONFIG_WRITE_ERR = 
NODE_CONFIGURATION_ERR_GROUP.registerErrorCode(3);
     }
+
+    /**
+     * Code deployment error group.
+     */
+    public static class CodeDeployment {
+        /**
+         * Code deployment error group.
+         */
+        public static final ErrorGroup CODE_DEPLOYMENT_ERR_GROUP = 
ErrorGroup.newGroup("CODEDEPLOY", 13);
+
+        /**
+         * Config read error.
+         */
+        public static final int UNDEPLOY_NOT_EXISTED_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(1);
+
+        /**
+         * Unit duplicate error.
+         */
+        public static final int DUPLICATE_DEPLOY_UNIT_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(2);

Review Comment:
   ```suggestion
           public static final int UNIT_ALREADY_EXISTS_ERR = 
CODE_DEPLOYMENT_ERR_GROUP.registerErrorCode(2);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to