MINIFICPP-2765 Move GCP Extension to stable C API#2153
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the GCP extension from the legacy MiNiFi C++ extension model to the stable C API extension model, updating processors, controller services, and tests accordingly.
Changes:
- Ported GCP processors and the credentials controller service to the stable C API (
api::core::*) lifecycle (onScheduleImpl/onTriggerImpl/enableImpl). - Replaced
REGISTER_RESOURCEregistration with a newExtensionInitializer.cppusingMinifiInitExtensionregistration calls. - Updated GCP extension unit tests to use C API test utilities and adjusted test linking.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/gcp/tests/PutGCSObjectTests.cpp | Updates processor tests to use C API processor/controller-service wrappers and shared mock client injection. |
| extensions/gcp/tests/ListGCSBucketTests.cpp | Updates list-bucket tests to C API controller service creation and processor property setting. |
| extensions/gcp/tests/GCPCredentialsControllerServiceTests.cpp | Adjusts controller service tests for C API controller service wrapper access and property setting. |
| extensions/gcp/tests/FetchGCSObjectTests.cpp | Refactors fetch tests to C API processor creation and property accessors. |
| extensions/gcp/tests/DeleteGCSObjectTests.cpp | Refactors delete tests to C API processor creation and property accessors. |
| extensions/gcp/tests/CMakeLists.txt | Switches test linking to libminifi-c-unittest for the C API test harness. |
| extensions/gcp/processors/PutGCSObject.h | Moves processor to C API lifecycle overrides and updates includes/annotations. |
| extensions/gcp/processors/PutGCSObject.cpp | Implements onScheduleImpl / onTriggerImpl and uses API property parsing and session attribute APIs. |
| extensions/gcp/processors/ListGCSBucket.h | Moves processor to C API lifecycle overrides and updates includes/annotations. |
| extensions/gcp/processors/ListGCSBucket.cpp | Implements onScheduleImpl / onTriggerImpl and uses API property parsing and session attribute APIs. |
| extensions/gcp/processors/GCSProcessor.h | Migrates base processor to api::core::ProcessorImpl and updates scheduling/credentials retrieval APIs. |
| extensions/gcp/processors/GCSProcessor.cpp | Implements onScheduleImpl and updates controller service parsing to API utilities. |
| extensions/gcp/processors/FetchGCSObject.h | Moves processor to C API lifecycle overrides and updates includes/annotations. |
| extensions/gcp/processors/FetchGCSObject.cpp | Implements onScheduleImpl / onTriggerImpl and uses API property parsing and session attribute APIs. |
| extensions/gcp/processors/DeleteGCSObject.h | Moves processor to C API lifecycle overrides and updates includes/annotations. |
| extensions/gcp/processors/DeleteGCSObject.cpp | Implements onTriggerImpl and uses API property parsing and session attribute APIs. |
| extensions/gcp/controllerservices/GCPCredentialsControllerService.h | Migrates controller service to api::core::ControllerServiceImpl and introduces enableImpl. |
| extensions/gcp/controllerservices/GCPCredentialsControllerService.cpp | Implements credentials loading via controller service context and adds file-content helper. |
| extensions/gcp/GCPAttributes.h | Switches metadata attribute setting to use api::core::ProcessSession::setAttribute. |
| extensions/gcp/ExtensionInitializer.cpp | Adds stable C API extension entry point and registers processors/controller service. |
| extensions/gcp/CMakeLists.txt | Registers the extension via register_c_api_extension and links extension lib accordingly. |
Comments suppressed due to low confidence (1)
extensions/gcp/controllerservices/GCPCredentialsControllerService.cpp:1
- enableImpl() always returns MINIFI_STATUS_SUCCESS, even when the credentials location is invalid or credential creation fails (credentials_ stays null). This can leave the controller service enabled in a broken state and shifts the failure downstream. Return a non-success status (and ideally stop enabling) when credentials_location is missing/invalid or when credentials_ could not be created.
/**
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
080caf9 to
598f925
Compare
936d6ee to
6c3628f
Compare
6c3628f to
ac458cf
Compare
695bec5 to
95d8bdf
Compare
|
I'll draft it until #2112 merges |
97c898a to
0bb815e
Compare
6f454a1 to
07ee70d
Compare
|
|
||
| template <size_t N> | ||
| struct StringLiteral { | ||
| char value[N]; | ||
| constexpr StringLiteral(const char (&str)[N]) { // NOLINT(runtime/explicit) | ||
| for (size_t i = 0; i < N; ++i) { | ||
| value[i] = str[i]; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| // A variable template that creates permanent static memory for the span to point to | ||
| template <StringLiteral str> | ||
| inline constexpr auto StaticAllowedType = std::array<std::string_view, 1>{std::string_view{str.value, sizeof(str.value) - 1}}; | ||
| } // namespace detail |
There was a problem hiding this comment.
This is required for this to work
https://github.com/apache/nifi-minifi-cpp/pull/2153/changes#diff-0404937d5b253fb100b47ee1ae38b62125eb24f0461acb2faa431d236713933bR56
b89c26e to
a801889
Compare
e4f700e to
c9060a8
Compare
4d18c0d to
0a3ae8b
Compare
2cac27e to
97b90aa
Compare
d23b6b8 to
62fa423
Compare
|
removed the ready-to-merge label due to merge conflicts |
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.