This is an automated email from the ASF dual-hosted git repository. isapego pushed a commit to branch ignite-17424 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 63f137235bd9ec6508d1770c01d612ea1fb878ed Author: Igor Sapego <[email protected]> AuthorDate: Wed Aug 31 09:01:30 2022 +0400 IGNITE-17424 IgniteClient implementation stub --- .../cpp/client/include/ignite/ignite_client.h | 15 +++-- modules/platforms/cpp/client/src/ignite_client.cpp | 15 ++++- .../platforms/cpp/client/src/ignite_client_impl.h | 65 ++++++++++++++++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/modules/platforms/cpp/client/include/ignite/ignite_client.h b/modules/platforms/cpp/client/include/ignite/ignite_client.h index 3c47c31641..4a8b45d30e 100644 --- a/modules/platforms/cpp/client/include/ignite/ignite_client.h +++ b/modules/platforms/cpp/client/include/ignite/ignite_client.h @@ -37,14 +37,14 @@ class IgniteClient { public: // Deleted - IgniteClient() = delete; + IgniteClient(const IgniteClient&) = delete; + IgniteClient& operator=(const IgniteClient&) = delete; // Default + IgniteClient() = default; ~IgniteClient() = default; IgniteClient(IgniteClient&&) = default; - IgniteClient(const IgniteClient&) = default; IgniteClient& operator=(IgniteClient&&) = default; - IgniteClient& operator=(const IgniteClient&) = default; /** * Start client asynchronously. @@ -68,8 +68,15 @@ public: static std::future<IgniteClient> startAsync(IgniteClientConfiguration configuration); private: + /** + * Constructor + * + * @param impl Implementation + */ + explicit IgniteClient(std::unique_ptr<impl::IgniteClientImpl> impl); + /** Implementation. */ - std::shared_ptr<impl::IgniteClientImpl> m_impl; + std::unique_ptr<impl::IgniteClientImpl> m_impl; }; } // namespace ignite \ No newline at end of file diff --git a/modules/platforms/cpp/client/src/ignite_client.cpp b/modules/platforms/cpp/client/src/ignite_client.cpp index e94dd89d1e..ddb8975344 100644 --- a/modules/platforms/cpp/client/src/ignite_client.cpp +++ b/modules/platforms/cpp/client/src/ignite_client.cpp @@ -17,12 +17,25 @@ #include "ignite/ignite_client.h" +#include "ignite_client_impl.h" + namespace ignite { + std::future<IgniteClient> IgniteClient::startAsync(IgniteClientConfiguration configuration) { - return {}; + return std::async(std::launch::async, [cfg = std::move(configuration)]() { + + auto impl = std::make_unique<impl::IgniteClientImpl>(cfg); + + impl->start(); + + return IgniteClient(std::move(impl)); + }); } +IgniteClient::IgniteClient(std::unique_ptr<impl::IgniteClientImpl> impl) : + m_impl(std::move(impl)) { } + } // namespace ignite diff --git a/modules/platforms/cpp/client/src/ignite_client_impl.h b/modules/platforms/cpp/client/src/ignite_client_impl.h new file mode 100644 index 0000000000..17be39464f --- /dev/null +++ b/modules/platforms/cpp/client/src/ignite_client_impl.h @@ -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. + */ + +#pragma once + +#include <future> +#include <memory> + +#include "ignite/ignite_client_configuration.h" + +namespace ignite::impl +{ + +/** + * Ignite client implementation. + */ +class IgniteClientImpl +{ +public: + // Deleted + IgniteClientImpl(const IgniteClientImpl&) = delete; + IgniteClientImpl& operator=(const IgniteClientImpl&) = delete; + + // Default + IgniteClientImpl() = default; + ~IgniteClientImpl() = default; + IgniteClientImpl(IgniteClientImpl&&) = default; + IgniteClientImpl& operator=(IgniteClientImpl&&) = default; + + /** + * Constructor. + * + * @param configuration Configuration. + */ + explicit IgniteClientImpl(IgniteClientConfiguration configuration) : + m_configuration(std::move(configuration)) { } + + /** + * Start client. + */ + void start() + { + // TODO + } + +private: + /** Configuration. */ + IgniteClientConfiguration m_configuration; +}; + +} // namespace ignite::impl \ No newline at end of file
