Skip to content

MINIFICPP-2816 Add controller_service::api_implementations to C api#2176

Open
martinzink wants to merge 2 commits into
apache:gcp_to_c_apifrom
martinzink:c_api_controller_service_traits
Open

MINIFICPP-2816 Add controller_service::api_implementations to C api#2176
martinzink wants to merge 2 commits into
apache:gcp_to_c_apifrom
martinzink:c_api_controller_service_traits

Conversation

@martinzink
Copy link
Copy Markdown
Member

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:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a get_interface callback to the C controller-service ABI, plumbed through useControllerServiceClassDefinition and useCControllerServiceClassDescription into ClassDescription::api_implementations.
  • Introduced a C++-side ProvidedInterface / createProvidedInterface helper and a ControllerServiceType::minifiSystemControllerServiceType factory.
  • Added a new stable-api-sandbox extension (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.

Comment thread extensions/stable-api-sandbox/ExtensionInitializer.cpp Outdated
Comment thread minifi-api/include/minifi-c/minifi-c.h
Comment thread libminifi/src/minifi-c.cpp Outdated
Comment thread minifi-api/common/include/minifi-cpp/core/ProvidedControllerServiceInterface.h Outdated
Comment thread extensions/stable-api-sandbox/AnimalControllerServiceApis.h
@martinzink martinzink force-pushed the c_api_controller_service_traits branch from 615a1aa to 8a61732 Compare May 15, 2026 12:35
@martinzink martinzink changed the base branch from main to gcp_to_c_api May 15, 2026 12:35
@martinzink martinzink requested a review from Copilot May 15, 2026 12:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Comment thread minifi-api/include/minifi-c/minifi-c.h Outdated
Comment thread libminifi/src/minifi-c.cpp
Comment thread extensions/stable-api-sandbox/tests/ZooTests.cpp Outdated
Comment thread extensions/stable-api-sandbox/tests/ZooTests.cpp Outdated
@martinzink martinzink force-pushed the c_api_controller_service_traits branch 2 times, most recently from e37d114 to 3f19d56 Compare May 18, 2026 11:40
@martinzink martinzink force-pushed the c_api_controller_service_traits branch from 3f19d56 to 4df654c Compare May 26, 2026 13:23
@martinzink martinzink force-pushed the gcp_to_c_api branch 2 times, most recently from a663671 to b607c29 Compare May 27, 2026 15:14
@martinzink martinzink force-pushed the c_api_controller_service_traits branch 3 times, most recently from 75dec07 to 6fc9e41 Compare May 28, 2026 05:48
@martinzink martinzink force-pushed the gcp_to_c_api branch 2 times, most recently from 2cac27e to 97b90aa Compare May 28, 2026 13:52
@martinzink martinzink force-pushed the c_api_controller_service_traits branch from 6fc9e41 to 7d06f20 Compare May 28, 2026 13:54
@martinzink martinzink force-pushed the c_api_controller_service_traits branch from 7d06f20 to e727372 Compare May 28, 2026 14:02
@martinzink martinzink marked this pull request as ready for review May 29, 2026 14:57

explicit ControllerServiceFactoryImpl(std::string group_name)
: group_name_(std::move(group_name)),
explicit ControllerServiceFactoryImpl(std::string module_name)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive renamed it from group_name to module_name, because this groupname was not the groupname in C2 but rather the artifact name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants