MINIFICPP-2816 Add controller_service::api_implementations to C api#2176
MINIFICPP-2816 Add controller_service::api_implementations to C api#2176martinzink wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the C extension API for MiNiFi C++ to let C-based controller services declare and expose multiple "provided interfaces" (additional C++ APIs they implement). The agent surfaces these as api_implementations in class descriptions, and MinifiProcessContextGetControllerService now uses a new get_interface callback to cast a controller service implementation to a requested API type. A new stable-api-sandbox test extension exercises the feature with Dog/Duck controller services that both implement CanFlyControllerApi and NumberOfLegsControllerApi, consumed by a ZooProcessor.
Changes:
- Added
provided_interfaces_*and aget_interfacecallback to the C controller-service ABI, plumbed throughuseControllerServiceClassDefinitionanduseCControllerServiceClassDescriptionintoClassDescription::api_implementations. - Introduced a C++-side
ProvidedInterface/createProvidedInterfacehelper and aControllerServiceType::minifiSystemControllerServiceTypefactory. - Added a new
stable-api-sandboxextension (controller services, processor, init, tests, CMake) demonstrating and testing the multi-interface controller service flow.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| minifi-api/include/minifi-c/minifi-c.h | Adds provided_interfaces_* fields and get_interface callback to controller-service C ABI structs. |
| minifi-api/include/minifi-cpp/core/ControllerServiceType.h | Adds minifiSystemControllerServiceType factory and tightens reformatting; private ctor for raw fields. |
| minifi-api/common/include/minifi-cpp/core/ProvidedControllerServiceInterface.h | New header defining ProvidedInterface and the createProvidedInterface helper template. |
| extension-framework/cpp-extension-lib/include/api/core/Resource.h | Wires Class::ProvidedInterfaces into the C definition and implements the get_interface lambda. |
| libminifi/src/minifi-c.cpp | Builds api_implementations from C-side interface names; uses get_interface in MinifiProcessContextGetControllerService. |
| extensions/stable-api-sandbox/AnimalControllerServiceApis.h | Defines two abstract controller-service APIs used by the sandbox tests. |
| extensions/stable-api-sandbox/AnimalControllerServices.{h,cpp} | DogController/DuckController implementing both APIs and declaring ProvidedInterfaces. |
| extensions/stable-api-sandbox/ZooProcessor.{h,cpp} | Test processor that fetches both interfaces from configured controller services. |
| extensions/stable-api-sandbox/ExtensionInitializer.cpp | Registers the new processor and controller services as a C extension. |
| extensions/stable-api-sandbox/CMakeLists.txt | New CMake module building the sandbox extension. |
| extensions/stable-api-sandbox/tests/CMakeLists.txt | Builds the sandbox extension's tests. |
| extensions/stable-api-sandbox/tests/ZooTests.cpp | End-to-end test exercising multi-interface lookup via the C API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
615a1aa to
8a61732
Compare
e37d114 to
3f19d56
Compare
3f19d56 to
4df654c
Compare
a663671 to
b607c29
Compare
75dec07 to
6fc9e41
Compare
2cac27e to
97b90aa
Compare
6fc9e41 to
7d06f20
Compare
7d06f20 to
e727372
Compare
|
|
||
| explicit ControllerServiceFactoryImpl(std::string group_name) | ||
| : group_name_(std::move(group_name)), | ||
| explicit ControllerServiceFactoryImpl(std::string module_name) |
There was a problem hiding this comment.
Ive renamed it from group_name to module_name, because this groupname was not the groupname in C2 but rather the artifact name
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically main)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.