-
Notifications
You must be signed in to change notification settings - Fork 99
MINIFICPP-2669 - Reduce controller service api #2065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4896a49
MINIFICPP-2669 - Reduce controller service api
adamdebreceni fdb8926
Remove some virtual inhertiance fix linux build
adamdebreceni a722233
MINIFICPP-2669 - Clang tidy fix
adamdebreceni 3eb9c99
MINIFICPP-2669 - Test fix
adamdebreceni f57637e
MINIFICPP-2669 - Remove invalid logger
adamdebreceni 36ae84c
MINIFICPP-2669 - Formatting fix
adamdebreceni bc165fb
MINIFICPP-2669 - Rebase fix
adamdebreceni 063bb30
MINIFICPP-2669 - Remove ThreadManagementService, review changes
adamdebreceni 9b469d6
MINIFICPP-2669 - Fix build
adamdebreceni 26c03cd
MINIFICPP-2669 - Fix build
adamdebreceni 30f5ca1
Update core-framework/include/utils/ThreadPool.h
adamdebreceni 2342f3b
MINIFICPP-2669 - Review changes
adamdebreceni ade4556
Update libminifi/test/libtest/unit/ControllerServiceUtils.h
adamdebreceni 39b4be8
MINIFICPP-2669 - Rename to ControllerServiceHandle
adamdebreceni 70016b5
MINIFICPP-2669 - Fix
adamdebreceni 3ca5595
MINIFICPP-2669 - Mark property deprecated
adamdebreceni e7eca75
MINIFICPP-2669 - Update docs
adamdebreceni 648e8b4
MINIFICPP-2669 - Fix rename
adamdebreceni ba6d102
MINIFICPP-2669 - Comments, clang tidy fix
adamdebreceni ba875b7
MINIFICPP-2669 - Review changes
adamdebreceni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 0 additions & 121 deletions
121
core-framework/include/core/controller/ControllerService.h
This file was deleted.
Oops, something went wrong.
114 changes: 114 additions & 0 deletions
114
core-framework/include/core/controller/ControllerServiceBase.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| /** | ||
| * | ||
| * 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 <memory> | ||
| #include <string> | ||
| #include <utility> | ||
| #include <vector> | ||
|
|
||
| #include "minifi-cpp/properties/Configure.h" | ||
| #include "core/Core.h" | ||
| #include "core/ConfigurableComponentImpl.h" | ||
| #include "core/Connectable.h" | ||
| #include "minifi-cpp/core/controller/ControllerServiceApi.h" | ||
| #include "minifi-cpp/core/controller/ControllerServiceHandle.h" | ||
| #include "minifi-cpp/core/ControllerServiceApiDefinition.h" | ||
| #include "minifi-cpp/core/controller/ControllerServiceMetadata.h" | ||
|
|
||
| #define ADD_COMMON_VIRTUAL_FUNCTIONS_FOR_CONTROLLER_SERVICES \ | ||
| bool supportsDynamicProperties() const override { return SupportsDynamicProperties; } | ||
|
|
||
| namespace org::apache::nifi::minifi::core::controller { | ||
|
|
||
| class ControllerServiceBase : public ControllerServiceApi { | ||
| public: | ||
| explicit ControllerServiceBase(ControllerServiceMetadata metadata) | ||
| : name_(std::move(metadata.name)), | ||
| uuid_(metadata.uuid), | ||
| logger_(std::move(metadata.logger)) {} | ||
|
|
||
| virtual void initialize() = 0; | ||
|
|
||
| void initialize(ControllerServiceDescriptor& descriptor) final { | ||
| gsl_Expects(!descriptor_); | ||
| descriptor_ = &descriptor; | ||
| auto guard = gsl::finally([&] {descriptor_ = nullptr;}); | ||
| initialize(); | ||
|
szaszm marked this conversation as resolved.
|
||
| } | ||
|
|
||
| void setSupportedProperties(std::span<const PropertyReference> properties) { | ||
| gsl_Expects(descriptor_); | ||
| descriptor_->setSupportedProperties(properties); | ||
| } | ||
|
|
||
| ControllerServiceBase(const ControllerServiceBase&) = delete; | ||
| ControllerServiceBase(ControllerServiceBase&&) = delete; | ||
| ControllerServiceBase& operator=(const ControllerServiceBase&) = delete; | ||
| ControllerServiceBase& operator=(ControllerServiceBase&&) = delete; | ||
|
|
||
| ~ControllerServiceBase() noexcept override = default; | ||
|
|
||
| virtual void onEnable() = 0; | ||
|
|
||
| void onEnable(ControllerServiceContext& context, const std::shared_ptr<Configure>& configuration, const std::vector<std::shared_ptr<ControllerServiceHandle>>& linked_services) final { | ||
| configuration_ = configuration; | ||
| linked_services_ = linked_services; | ||
| gsl_Expects(!context_); | ||
| context_ = &context; | ||
| auto guard = gsl::finally([&] {context_ = nullptr;}); | ||
| onEnable(); | ||
| } | ||
|
|
||
| [[nodiscard]] nonstd::expected<std::string, std::error_code> getProperty(std::string_view name) const { | ||
| gsl_Expects(context_); | ||
| return context_->getProperty(name); | ||
| } | ||
|
|
||
| [[nodiscard]] nonstd::expected<std::vector<std::string>, std::error_code> getAllPropertyValues(std::string_view name) const { | ||
| gsl_Expects(context_); | ||
| return context_->getAllPropertyValues(name); | ||
| } | ||
|
|
||
| void notifyStop() override {} | ||
|
|
||
| std::string getName() const { | ||
| return name_; | ||
| } | ||
|
|
||
| utils::Identifier getUUID() const { | ||
| return uuid_; | ||
| } | ||
|
|
||
|
|
||
| static constexpr auto ImplementsApis = std::array<ControllerServiceApiDefinition, 0>{}; | ||
|
|
||
| protected: | ||
| std::string name_; | ||
| utils::Identifier uuid_; | ||
| std::vector<std::shared_ptr<controller::ControllerServiceHandle> > linked_services_; | ||
| std::shared_ptr<Configure> configuration_; | ||
| // valid during initialize, sink for supported properties | ||
| ControllerServiceDescriptor* descriptor_{nullptr}; | ||
| // valid during onEnable, provides property access | ||
| ControllerServiceContext* context_{nullptr}; | ||
|
szaszm marked this conversation as resolved.
|
||
|
|
||
| std::shared_ptr<core::logging::Logger> logger_; | ||
| }; | ||
|
|
||
| } // namespace org::apache::nifi::minifi::core::controller | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.