adamdebreceni commented on code in PR #1987:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1987#discussion_r2544656468


##########
minifi-api/include/minifi-c/minifi-c.h:
##########
@@ -24,24 +24,200 @@ extern "C" {
 
 #include <stddef.h>
 #include <stdint.h>
+#if __STDC_VERSION__ < 202311l
+#  include <stdbool.h>
+#endif  // < C23
 
-typedef struct MinifiConfig MinifiConfig;
-typedef struct MinifiExtension MinifiExtension;
+#define MINIFI_PRIVATE_STRINGIFY_HELPER(X) #X
+#define MINIFI_PRIVATE_STRINGIFY(X) MINIFI_PRIVATE_STRINGIFY_HELPER(X)
+
+#define MINIFI_API_MAJOR_VERSION 0
+#define MINIFI_API_MINOR_VERSION 1
+#define MINIFI_API_PATCH_VERSION 0
+#define MINIFI_API_VERSION MINIFI_PRIVATE_STRINGIFY(MINIFI_API_MAJOR_VERSION) 
"." MINIFI_PRIVATE_STRINGIFY(MINIFI_API_MINOR_VERSION) "." 
MINIFI_PRIVATE_STRINGIFY(MINIFI_API_PATCH_VERSION)
+#define MINIFI_API_VERSION_TAG "MINIFI_API_VERSION=[" MINIFI_API_VERSION "]"
+#define MINIFI_NULL nullptr
+#define MINIFI_OWNED
+
+typedef bool MinifiBool;
+
+typedef enum MinifiInputRequirement {
+  MINIFI_INPUT_REQUIRED = 0,
+  MINIFI_INPUT_ALLOWED = 1,
+  MINIFI_INPUT_FORBIDDEN = 2
+} MinifiInputRequirement;
 
+/// Represents a non-owning read-only view to a sized, not necessarily 
null-terminated string.
+/// invariant: [data, data + length) is a valid range
 typedef struct MinifiStringView {
+  /// nullable, non-owning pointer to the beginning of a continuous character 
sequence
   const char* data;
+  /// the length of the buffer pointed-to by data
   size_t length;
 } MinifiStringView;
 
+/// Represents an output relationship of a processor, part of the processor 
metadata
+typedef struct MinifiRelationshipDefinition {
+  /// Name, processors use this to transfer flow files to the connections 
connected to this relationship using MinifiProcessSessionTransfer.
+  MinifiStringView name;
+  /// Human-readable description of what flow files get routed to this 
relationship. Included in C2 manifest and generated processor docs.
+  MinifiStringView description;
+} MinifiRelationshipDefinition;
+
+typedef struct MinifiOutputAttributeDefinition {
+  MinifiStringView name;
+  size_t relationships_count;
+  const MinifiStringView* relationships_ptr;
+  MinifiStringView description;
+} MinifiOutputAttributeDefinition;
+
+typedef struct MinifiDynamicProperty {
+  MinifiStringView name;
+  MinifiStringView value;
+  MinifiStringView description;
+  MinifiBool supports_expression_language;
+} MinifiDynamicProperty;
+
+typedef struct MinifiPropertyValidator MinifiPropertyValidator;
+typedef struct MinifiFlowFile MinifiFlowFile;
+typedef struct MinifiLogger MinifiLogger;
+typedef struct MinifiProcessContext MinifiProcessContext;
+typedef struct MinifiProcessSession MinifiProcessSession;
+typedef struct MinifiInputStream MinifiInputStream;
+typedef struct MinifiOutputStream MinifiOutputStream;
+typedef struct MinifiConfig MinifiConfig;
+typedef struct MinifiExtension MinifiExtension;
+typedef struct MinifiPublishedMetrics MinifiPublishedMetrics;
+
+typedef enum MinifiStatus {
+  MINIFI_STATUS_SUCCESS = 0,
+  MINIFI_STATUS_UNKNOWN_ERROR = 1,
+  MINIFI_STATUS_NOT_SUPPORTED_PROPERTY = 2,
+  MINIFI_STATUS_DYNAMIC_PROPERTIES_NOT_SUPPORTED = 3,
+  MINIFI_STATUS_PROPERTY_NOT_SET = 4,
+  MINIFI_STATUS_VALIDATION_FAILED = 5,
+  MINIFI_STATUS_PROCESSOR_YIELD = 6
+} MinifiStatus;
+
+typedef struct MinifiProperty {
+  MinifiStringView name;
+  MinifiStringView display_name;
+  MinifiStringView description;
+  MinifiBool is_required;
+  MinifiBool is_sensitive;
+
+  const MinifiStringView* default_value;
+  size_t allowed_values_count;
+  const MinifiStringView* allowed_values_ptr;
+  const MinifiPropertyValidator* validator;
+
+  const MinifiStringView* type;
+  MinifiBool supports_expression_language;
+} MinifiProperty;
+
+typedef enum MinifiLogLevel {
+  MINIFI_LOG_LEVEL_TRACE = 0,
+  MINIFI_LOG_LEVEL_DEBUG = 1,
+  MINIFI_LOG_LEVEL_INFO = 2,
+  MINIFI_LOG_LEVEL_WARNING = 3,
+  MINIFI_LOG_LEVEL_ERROR = 4,
+  MINIFI_LOG_LEVEL_CRITICAL = 5,
+  MINIFI_LOG_LEVEL_OFF = 6
+} MinifiLogLevel;
+
+typedef struct MinifiProcessorMetadata {
+  MinifiStringView uuid;
+  MinifiStringView name;
+  MinifiLogger* logger;  // borrowed reference, live until the processor is 
live
+} MinifiProcessorMetadata;
+
+typedef struct MinifiProcessorCallbacks {
+  MINIFI_OWNED void*(*create)(MinifiProcessorMetadata);
+  void(*destroy)(MINIFI_OWNED void*);
+  MinifiBool(*isWorkAvailable)(void*);
+  void(*restore)(void*, MINIFI_OWNED MinifiFlowFile*);
+  MinifiBool(*getTriggerWhenEmpty)(void*);
+  MinifiStatus(*onTrigger)(void*, MinifiProcessContext*, 
MinifiProcessSession*);
+  MinifiStatus(*onSchedule)(void*, MinifiProcessContext*);
+  void(*onUnSchedule)(void*);
+  MINIFI_OWNED MinifiPublishedMetrics*(*calculateMetrics)(void*);
+} MinifiProcessorCallbacks;
+
+typedef struct MinifiProcessorClassDescription {
+  MinifiStringView full_name;  // '::'-delimited fully qualified name e.g. 
'org::apache::nifi::minifi::GenerateFlowFile'
+  MinifiStringView description;
+  size_t class_properties_count;
+  const MinifiProperty* class_properties_ptr;
+  size_t dynamic_properties_count;
+  const MinifiDynamicProperty* dynamic_properties_ptr;
+  size_t class_relationships_count;
+  const MinifiRelationshipDefinition* class_relationships_ptr;
+  size_t output_attributes_count;
+  const MinifiOutputAttributeDefinition* output_attributes_ptr;
+  MinifiBool supports_dynamic_properties;
+  MinifiBool supports_dynamic_relationships;
+  MinifiInputRequirement input_requirement;
+  MinifiBool is_single_threaded;
+
+  MinifiProcessorCallbacks callbacks;
+} MinifiProcessorClassDescription;
+
+typedef enum MinifiStandardPropertyValidator {
+  MINIFI_ALWAYS_VALID_VALIDATOR = 0,
+  MINIFI_NON_BLANK_VALIDATOR = 1,
+  MINIFI_TIME_PERIOD_VALIDATOR = 2,
+  MINIFI_BOOLEAN_VALIDATOR = 3,
+  MINIFI_INTEGER_VALIDATOR = 4,
+  MINIFI_UNSIGNED_INTEGER_VALIDATOR = 5,
+  MINIFI_DATA_SIZE_VALIDATOR = 6,
+  MINIFI_PORT_VALIDATOR = 7
+} MinifiStandardPropertyValidator;
+
 typedef struct MinifiExtensionCreateInfo {
   MinifiStringView name;
   MinifiStringView version;
-  void(*deinit)(void* user_data);
+  void(*deinit)(void*);

Review Comment:
   readded



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to