Skip to content

Conversation

@adamdebreceni
Copy link
Contributor

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.

@adamdebreceni adamdebreceni changed the base branch from minifi-api-reduced to main August 21, 2025 09:54
@adamdebreceni adamdebreceni force-pushed the processor-c-api branch 2 times, most recently from f35808b to 9807e09 Compare September 10, 2025 11:57
@adamdebreceni adamdebreceni changed the base branch from main to MINIFICPP-2629 September 22, 2025 11:34
@lordgamez lordgamez force-pushed the MINIFICPP-2629 branch 3 times, most recently from 054fd16 to a57636f Compare October 1, 2025 08:28
@adamdebreceni adamdebreceni force-pushed the processor-c-api branch 2 times, most recently from bb60828 to 4de141c Compare October 7, 2025 12:45
@adamdebreceni adamdebreceni changed the title WIP processor c api MINIFICPP-2650 - Processor c api Oct 14, 2025
@martinzink martinzink requested a review from Copilot October 15, 2025 08:45
Copy link

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 introduces a comprehensive C API framework for MiniFi C++ that enables plugins to be written in C while leveraging the existing C++ infrastructure. The implementation adds a processor C API layer that allows C-based extensions to integrate seamlessly with the MiniFi processing pipeline.

Key changes include:

  • New C API interface with MiniFi-specific types and callback structures
  • C API framework implementation that bridges C extensions to C++ core functionality
  • Refactored include paths and modularized architecture to support multiple API layers
  • Enhanced extension loading system that can verify and load both C++ and C API extensions

Reviewed Changes

Copilot reviewed 102 out of 143 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
minifi-api/include/minifi-c/minifi-c.h Complete C API interface definition with processor callbacks and data structures
libminifi/src/minifi-c.cpp C API implementation that bridges C calls to C++ MiniFi functionality
core-framework/c-api-framework/ New framework providing C++ wrappers for C API components
libminifi/include/utils/CProcessor.h C processor wrapper enabling C extensions to participate in C++ processing pipeline
core-framework/include/core/extension/Utils.h Enhanced extension verification supporting both C++ and C API libraries
Comments suppressed due to low confidence (1)

libminifi/src/minifi-c.cpp:1

  • This reinterpret_cast is unsafe and could lead to undefined behavior. The function should verify the type safety or use a safer casting mechanism.
/**

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@adamdebreceni adamdebreceni marked this pull request as ready for review October 15, 2025 14:59
Copy link
Member

@martinzink martinzink left a comment

Choose a reason for hiding this comment

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

Since #2029 is already merged could you please rebase and retarget this PR to main?

@adamdebreceni adamdebreceni changed the base branch from MINIFICPP-2629 to main October 22, 2025 08:32
@adamdebreceni adamdebreceni marked this pull request as draft October 22, 2025 12:04
@adamdebreceni adamdebreceni marked this pull request as ready for review October 22, 2025 12:04
Copy link
Member

@szaszm szaszm left a comment

Choose a reason for hiding this comment

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

early API comments

Comment on lines 159 to 156
uint32_t dynamic_properties_count;
const MinifiDynamicProperty* dynamic_properties_ptr;
Copy link
Member

Choose a reason for hiding this comment

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

I think we're mixing description and runtime values here. In a processor description/manifest, dynamic properties are only represented as supported/unsupported, while their values are a runtime information. I would remove these members.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need this for docs generation, as they are in a separate section

@martinzink martinzink added the priority Review these first label Oct 28, 2025

virtual void setSupportedRelationships(std::span<const RelationshipDefinition> relationships) = 0;
virtual void setSupportedProperties(std::span<const PropertyReference> properties) = 0;
virtual void setSupportedProperties(std::span<const Property> properties) = 0;
Copy link
Member

Choose a reason for hiding this comment

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

why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we previously had a Property::getReference that worked incorrectly discarding types and allowed_values, since despite its name a Property is not easy to convert to PropertyReference, the former stores std::vector<std::string> while the latter uses std::span<const std::string_view> (this caused an issue in python processors as well)

Comment on lines +113 to +116
set_target_properties(${extension-name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
Copy link
Member

Choose a reason for hiding this comment

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

I would add the export macros in the C API extensions and not export all symbols. CMake's GenerateExportHeader can make it simpler. At least that's the vision, but maybe there are blockers preventing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this only has utility in tests where we directly link the test to (in this case) libminifi-llamacpp.dll, since we are directly driving the processor in the test (not waiting for the extension to register the callbacks) we need access to all member function symbols

Copy link
Member

Choose a reason for hiding this comment

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

do we no longer log IDs? because I don't see them on the interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the trimming + id append has been moved upstream into LoggerBase

@martinzink martinzink closed this in ef3dd56 Dec 1, 2025
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.

5 participants