You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2023/06/26 22:53:29 UTC

[ignite-3] 01/06: IGNITE-19625 Add deployment_unit

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

isapego pushed a commit to branch ignite-19625
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 2cb9537614c44a6a37843ff4c760fb4727e33161
Author: Igor Sapego <is...@apache.org>
AuthorDate: Tue Jun 27 01:00:55 2023 +0400

    IGNITE-19625 Add deployment_unit
---
 modules/platforms/cpp/ignite/client/CMakeLists.txt |  1 +
 .../platforms/cpp/ignite/client/compute/compute.h  |  1 +
 .../cpp/ignite/client/compute/deployment_unit.h    | 81 ++++++++++++++++++++++
 3 files changed, 83 insertions(+)

diff --git a/modules/platforms/cpp/ignite/client/CMakeLists.txt b/modules/platforms/cpp/ignite/client/CMakeLists.txt
index 9284057e96..20c312e846 100644
--- a/modules/platforms/cpp/ignite/client/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/client/CMakeLists.txt
@@ -49,6 +49,7 @@ set(PUBLIC_HEADERS
     primitive.h
     type_mapping.h
     compute/compute.h
+    compute/deployment_unit.h
     detail/type_mapping_utils.h
     network/cluster_node.h
     sql/sql.h
diff --git a/modules/platforms/cpp/ignite/client/compute/compute.h b/modules/platforms/cpp/ignite/client/compute/compute.h
index 5f685b4a09..115e8be5ec 100644
--- a/modules/platforms/cpp/ignite/client/compute/compute.h
+++ b/modules/platforms/cpp/ignite/client/compute/compute.h
@@ -17,6 +17,7 @@
 
 #pragma once
 
+#include "ignite/client/compute/deployment_unit.h"
 #include "ignite/client/network/cluster_node.h"
 #include "ignite/client/primitive.h"
 #include "ignite/client/table/ignite_tuple.h"
diff --git a/modules/platforms/cpp/ignite/client/compute/deployment_unit.h b/modules/platforms/cpp/ignite/client/compute/deployment_unit.h
new file mode 100644
index 0000000000..238c0289f5
--- /dev/null
+++ b/modules/platforms/cpp/ignite/client/compute/deployment_unit.h
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <string>
+
+namespace ignite {
+
+/**
+ * Deployment unit identifier.
+ */
+class deployment_unit {
+
+public:
+    static const inline std::string LATEST_VERSION{"latest"};
+
+    // Delete
+    deployment_unit() = delete;
+
+    /**
+     * Constructor.
+     *
+     * @param name Unit name.
+     * @param version Unit version. Defaults to @c LATEST_VERSION.
+     */
+    deployment_unit(std::string name, std::string version = LATEST_VERSION) // NOLINT(google-explicit-constructor)
+        : m_name(std::move(name))
+        , m_version(std::move(version)) {}
+
+    /**
+     * Get name.
+     *
+     * @return Unit name.
+     */
+    [[nodiscard]] const std::string &get_name() const { return m_name; }
+
+    /**
+     * Set name.
+     *
+     * @param name Unit name to set.
+     */
+    void set_name(const std::string &name) { m_name = name; }
+
+    /**
+     * Get version.
+     *
+     * @return Unit version.
+     */
+    [[nodiscard]] const std::string &get_version() const { return m_version; }
+
+    /**
+     * Set version.
+     *
+     * @param version Unit version to set.
+     */
+    void set_version(const std::string &version) { m_version = version; }
+
+private:
+    /** Name. */
+    std::string m_name;
+
+    /** Version. */
+    std::string m_version;
+};
+
+} // namespace ignite