Skip to content

MINIFICPP-2850 Finalize stable API before 1.0#2205

Open
martinzink wants to merge 6 commits into
mainfrom
beke_2
Open

MINIFICPP-2850 Finalize stable API before 1.0#2205
martinzink wants to merge 6 commits into
mainfrom
beke_2

Conversation

@martinzink

Copy link
Copy Markdown
Member
  • removed MINIFI_NULL
  • remove struct/enum typedefs, and added struct/enum where necessary
  • CamelCase to snake_case (in minifi-api.h)
  • onTrigger -> trigger, onSChedule -> schedule, onUnSchedule -> unschedule
  • removed calculateMetrics from callbacks (replaced with minifi_process_context_report_metrics)
  • removed getTriggerWhenEmpty from callbacks (replaced with minifi_process_context_set_trigger_when_empty)
  • removed MinifiLoggerSetMaxLogSize (no replacement, we should reintroduce it if needed)
  • removed MinifiLoggerLevel (no replacement, we should reintroduce if needed)
  • removed c from API filenames (minifi-c-api.h -> minifi-api.h, minifi-c-api.def -> minifi-api.def etc.)
  • renamed minifi_property_definition::type -> minifi_property_definition::allowed_type
  • renamed class_properties_count -> properties_count, class_properties_ptr -> properties_ptr, class_relationships_ptr -> relationships_ptr etc
  • we also debated removing stdbool.h since we target C23 (but I've found that caused some problems in the rust wrapper so better to leave it for now)

There is also a second commit which fixes a bug remove minifiSystemControllerServiceType
the resulting change can be seen in the .github/references/ubuntu_22_04_clang_arm_manifest.json


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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 finalizes the “stable” MiNiFi C/C++ extension API surface in preparation for a 1.0 release by renaming and normalizing exported C symbols/headers, updating the C++ extension framework wrappers, and migrating extensions/tests to the new API (including new metrics reporting and trigger-when-empty control paths).

Changes:

  • Renamed/normalized the C API (header/DEF exports/symbol names) and updated consumers across the codebase.
  • Replaced the previous “calculateMetrics” callback path with minifi_process_context_report_metrics, and added minifi_process_context_set_trigger_when_empty.
  • Updated extension loading/verification, documentation, and release packaging to use the new stable API artifacts.

Reviewed changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
minifi-api/minifi-c-api.def Removed legacy Windows DEF export list (old symbol names).
minifi-api/minifi-api.def Added new Windows DEF export list for the renamed stable API.
minifi-api/include/minifi-cpp/core/ProcessorApi.h Added setTriggerWhenEmpty to the processor API interface.
minifi-api/include/minifi-cpp/core/ControllerServiceType.h Removed minifiSystemControllerServiceType helper; tightened ctor explicitness.
minifi-api/include/minifi-c/minifi-c.h Removed old C API header.
minifi-api/include/minifi-c/minifi-api.h Added new stable C API header (snake_case structs/functions).
minifi-api/common/include/minifi-cpp/io/StreamCallback.h Updated includes/types to the new C API names.
minifi-api/CMakeLists.txt Updated Windows import-lib generation to use minifi-api.def.
libminifi/test/libtest/unit/ContentRepositoryDependentTests.h Updated include to new stable C API header.
libminifi/test/integration/extension-verification-test/ExtensionVerificationTests.cpp Updated extension init symbol names in tests.
libminifi/test/integration/extension-verification-test/CreateNotCalled.cpp Updated test extension symbols/types to new API names.
libminifi/test/integration/extension-verification-test/CppApiExtension.cpp Updated C++ extension init symbol/type usage.
libminifi/test/integration/extension-verification-test/CApiExtension.cpp Updated C extension init symbol/type usage.
libminifi/src/utils/CProcessor.cpp Switched custom metrics retrieval to use reported-metrics storage.
libminifi/src/minifi-api.cpp Implemented renamed C API entry points; added context metric reporting and trigger-empty setter.
libminifi/src/core/state/nodes/AgentInformation.cpp Updated include to new stable C API header.
libminifi/src/core/ProcessSession.cpp Updated include to new stable C API header.
libminifi/src/core/Processor.cpp Added forwarding Processor::setTriggerWhenEmpty.
libminifi/src/core/extension/Extension.cpp Updated extension loader symbol names (minifi_init_*, minifi_api_version).
libminifi/src/core/extension/ApiVersion.cpp Updated include to new stable C API header.
libminifi/include/utils/CProcessor.h Updated callbacks/types to new C API; added internal trigger-when-empty/metrics wiring.
libminifi/include/utils/CControllerService.h Updated callbacks/types to new C API.
libminifi/include/core/Processor.h Added setTriggerWhenEmpty on Processor.
libminifi/include/core/extension/Extension.h Updated includes to new stable C API header.
extensions/stable-api-testing/ZooProcessor.h Updated return types to minifi_status.
extensions/stable-api-testing/ZooProcessor.cpp Updated return types to minifi_status.
extensions/stable-api-testing/ExtensionInitializer.cpp Updated exported symbols/types to new stable API names.
extensions/stable-api-testing/AnimalControllerServices.h Updated return types to minifi_status.
extensions/stable-api-testing/AnimalControllerServices.cpp Updated return types to minifi_status.
extensions/sftp/SFTPLoader.cpp Updated C++ extension init symbol/type usage and includes ordering.
extensions/python/pythonloader/PyProcLoader.cpp Updated init symbol and config access to new C API names.
extensions/python/pythonlibloader/PythonLibLoader.cpp Updated init symbol and config access to new C API names; include ordering.
extensions/llamacpp/processors/RunLlamaCppInference.h Updated stable API overrides; removed old metrics callback override.
extensions/llamacpp/processors/RunLlamaCppInference.cpp Reports metrics via ProcessContext::reportMetrics() on trigger.
extensions/llamacpp/ExtensionInitializer.cpp Updated exported symbols/types to new stable API names.
extensions/kafka/tests/PublishKafkaTests.cpp Updated mock flow-file type name.
extensions/kafka/PublishKafka.h Updated overrides to minifi_status.
extensions/kafka/PublishKafka.cpp Updated overrides to minifi_status.
extensions/kafka/KafkaProcessorBase.h Updated stable API include name.
extensions/kafka/ExtensionInitializer.cpp Updated exported symbols/types to new stable API names.
extensions/kafka/ConsumeKafka.h Updated overrides and helpers to minifi_status.
extensions/kafka/ConsumeKafka.cpp Updated trigger-when-empty usage to new context API; status renames.
extensions/gcp/processors/PutGCSObject.h Updated overrides to minifi_status.
extensions/gcp/processors/PutGCSObject.cpp Updated status comparisons/types to minifi_status.
extensions/gcp/processors/ListGCSBucket.h Updated overrides to minifi_status.
extensions/gcp/processors/ListGCSBucket.cpp Updated status comparisons/types to minifi_status.
extensions/gcp/processors/GCSProcessor.h Updated override to minifi_status.
extensions/gcp/processors/GCSProcessor.cpp Updated override to minifi_status.
extensions/gcp/processors/FetchGCSObject.h Updated overrides to minifi_status.
extensions/gcp/processors/FetchGCSObject.cpp Updated overrides to minifi_status.
extensions/gcp/processors/DeleteGCSObject.h Updated override to minifi_status.
extensions/gcp/processors/DeleteGCSObject.cpp Updated override to minifi_status.
extensions/gcp/ExtensionInitializer.cpp Updated exported symbols/types to new stable API names.
extensions/gcp/controllerservices/GCPCredentialsControllerService.h Updated override to minifi_status.
extensions/gcp/controllerservices/GCPCredentialsControllerService.cpp Updated override to minifi_status.
extensions/ExtensionInitializer.cpp Updated C++ extension init symbol/type usage and includes ordering.
extensions/aws/AwsLoader.cpp Updated init symbol/types to new stable API names; include ordering.
Extensions.md Updated extension doc symbol names (still needs further alignment with renamed types/APIs).
extension-framework/include/utils/ExtensionInitUtils.h Updated helper to use new stable C API types.
extension-framework/cpp-extension-lib/src/utils/minifi-c-utils.cpp Updated status/validator types to new names.
extension-framework/cpp-extension-lib/src/core/ProcessSession.cpp Updated C API calls/types to new names.
extension-framework/cpp-extension-lib/src/core/ProcessorImpl.cpp Updated return types to minifi_status.
extension-framework/cpp-extension-lib/src/core/ProcessContext.cpp Updated C API calls/types; added metrics reporting + trigger-when-empty setters.
extension-framework/cpp-extension-lib/src/core/logging/Logger.cpp Updated C API calls/types; currently stubs level/max-size (needs fix).
extension-framework/cpp-extension-lib/src/core/ControllerServiceImpl.cpp Updated return types to minifi_status.
extension-framework/cpp-extension-lib/src/core/ControllerServiceContext.cpp Updated C API calls/types to new names.
extension-framework/cpp-extension-lib/mocklib/src/MockProcessSession.cpp Updated mock flow-file type name.
extension-framework/cpp-extension-lib/mocklib/src/MockProcessContext.cpp Updated controller-service type name; removed hasNonEmptyProperty mock.
extension-framework/cpp-extension-lib/mocklib/src/mock-minifi-c.cpp Removed old mock C API implementation.
extension-framework/cpp-extension-lib/mocklib/src/mock-minifi-api.cpp Added mock implementation for the new stable C API.
extension-framework/cpp-extension-lib/mocklib/include/MockProcessSession.h Updated mock flow-file type name throughout.
extension-framework/cpp-extension-lib/mocklib/include/MockProcessContext.h Added metrics/trigger-when-empty mock support; updated controller-service type.
extension-framework/cpp-extension-lib/libtest/CProcessorTestUtils.h Updated class-definition types + controller-service bundle-name plumbing.
extension-framework/cpp-extension-lib/include/api/utils/minifi-c-utils.h Updated string/status/validator/property-definition types; renamed type -> allowed_type.
extension-framework/cpp-extension-lib/include/api/core/Resource.h Updated generated class definition structs/callbacks to new names; removed metrics callback path.
extension-framework/cpp-extension-lib/include/api/core/ProcessSession.h Updated C API include/type usage.
extension-framework/cpp-extension-lib/include/api/core/ProcessorImpl.h Updated return types; removed trigger-when-empty + metrics members from wrapper base.
extension-framework/cpp-extension-lib/include/api/core/ProcessContext.h Updated controller-service type + added metrics/trigger-when-empty APIs.
extension-framework/cpp-extension-lib/include/api/core/logging/Logger.h Updated logger handle type to new C API name.
extension-framework/cpp-extension-lib/include/api/core/FlowFile.h Updated flow-file handle type to new C API name.
extension-framework/cpp-extension-lib/include/api/core/ControllerServiceImpl.h Updated return types to minifi_status.
extension-framework/cpp-extension-lib/include/api/core/ControllerServiceContext.h Updated controller-service context handle type to new C API name.
core-framework/include/core/ProcessorImpl.h Marked setTriggerWhenEmpty override to satisfy new ProcessorApi.
.github/workflows/create-release-artifacts.yml Updated SDK artifact paths to minifi-api.h / minifi-api.def.
.github/references/ubuntu_22_04_clang_arm_manifest.json Manifest reference updates for controller-service provided API metadata.
.clang-format Tightened formatting rules (short blocks/ifs/enums).
Comments suppressed due to low confidence (2)

Extensions.md:83

  • The minifi_init_cpp_extension example still uses the old C API names (MinifiExtensionContext, MinifiConfigGet, MinifiStringView, MinifiExtensionDefinition). After the rename to minifi_* this snippet won't compile against the new headers.
extern "C" void minifi_init_cpp_extension(MinifiExtensionContext* extension_context) {
  static PythonLibLoader python_lib_loader([&] (std::string_view key) -> std::optional<std::string> {
    std::optional<std::string> result;
    MinifiConfigGet(extension_context, minifi::utils::toStringView(key), [] (void* user_data, MinifiStringView value) {
      *static_cast<std::optional<std::string>*>(user_data) = std::string{value.data, value.length};

libminifi/src/minifi-api.cpp:429

  • MinifiLoggerSetMaxLogSize is still defined inside the extern "C" block, but it no longer appears in minifi-api.h or the Windows export list (minifi-api.def). Leaving this legacy, CamelCase symbol in the binary risks accidentally keeping/introducing ABI surface that the PR description says was removed; it should be deleted (or renamed+declared+exported if it is still intended to be supported).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extension-framework/cpp-extension-lib/src/core/ProcessContext.cpp Outdated
Comment on lines +38 to 40
void CffiLogger::set_max_log_size(const int) {
throw std::runtime_error("Unimplemented C Api");
}

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.

i think we should throw maybe even abort because this shouldnt be called in theory

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove it from the interface altogether?

Comment on lines 50 to 52
[[nodiscard]] minifi::core::logging::LOG_LEVEL CffiLogger::level() const {
return toLogLevel(MinifiLoggerLevel(impl_));
throw std::runtime_error("Unimplemented C API");
}

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.

i think we should throw maybe even abort because this shouldnt be called in theory

Comment thread Extensions.md Outdated
Comment thread Extensions.md Outdated
Comment thread minifi-api/include/minifi-c/minifi-api.h
Comment thread libminifi/include/utils/CProcessor.h Outdated
Comment thread libminifi/src/utils/CProcessor.cpp
Comment thread minifi-api/include/minifi-c/minifi-api.h
Comment thread minifi-api/minifi-api.def Outdated
@martinzink martinzink added the priority Review these first label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority Review these first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants