You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "szaszm (via GitHub)" <gi...@apache.org> on 2023/06/30 09:23:00 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1589: MINIFICPP-1825 Create Properties at compile time

szaszm commented on code in PR #1589:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1589#discussion_r1247633966


##########
extensions/gcp/processors/ListGCSBucket.h:
##########
@@ -21,12 +21,26 @@
 #include <string>
 #include <utility>
 
+#include "../GCPAttributes.h"
 #include "GCSProcessor.h"
 #include "core/logging/LoggerConfiguration.h"
+#include "core/OutputAttributeDefinition.h"
+#include "core/PropertyDefinition.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "core/PropertyType.h"
+#include "core/RelationshipDefinition.h"
 #include "utils/ArrayUtils.h"
 
 namespace org::apache::nifi::minifi::extensions::gcp {
 
+namespace detail {
+inline constexpr std::string_view FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION_PART_1{"Same as "};
+inline constexpr auto FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION_ARRAY = utils::array_cat(
+    utils::string_view_to_array<FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION_PART_1.size()>(FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION_PART_1),
+    utils::string_view_to_array<GCS_OBJECT_NAME_ATTR.size()>(GCS_OBJECT_NAME_ATTR));
+inline constexpr auto FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION = utils::array_to_string_view(FILENAME_OUTPUT_ATTRIBUTE_DESCRIPTION_ARRAY);

Review Comment:
   All caps are better reserved for macros IMO, I'd use something else for typed constants. I don't think we have a consistent naming scheme for this, but both CamelCase and snake_case works for me. I think CamelCase is a bit more common in the codebase for constants, especially now that they're used for property definitions as well.
   The Google C++ style guide recommends kPrefixedCamelCase, but I don't really like that, and we don't follow this anywhere at the moment. https://google.github.io/styleguide/cppguide.html#Constant_Names



##########
extensions/mqtt/processors/AbstractMQTTProcessor.h:
##########
@@ -44,47 +59,76 @@ class AbstractMQTTProcessor : public core::Processor {
     freeResources();
   }
 
-  SMART_ENUM(MqttVersions,
-    (V_3X_AUTO, "3.x AUTO"),
-    (V_3_1_0, "3.1.0"),
-    (V_3_1_1, "3.1.1"),
-    (V_5_0, "5.0"));
-
-  SMART_ENUM(MqttQoS,
-    (LEVEL_0, "0"),
-    (LEVEL_1, "1"),
-    (LEVEL_2, "2"));
-
-  EXTENSIONAPI static const core::Property BrokerURI;
-  EXTENSIONAPI static const core::Property ClientID;
-  EXTENSIONAPI static const core::Property QoS;
-  EXTENSIONAPI static const core::Property MqttVersion;
-  EXTENSIONAPI static const core::Property ConnectionTimeout;
-  EXTENSIONAPI static const core::Property KeepAliveInterval;
-  EXTENSIONAPI static const core::Property LastWillTopic;
-  EXTENSIONAPI static const core::Property LastWillMessage;
-  EXTENSIONAPI static const core::Property LastWillQoS;
-  EXTENSIONAPI static const core::Property LastWillRetain;
-  EXTENSIONAPI static const core::Property LastWillContentType;
-  EXTENSIONAPI static const core::Property Username;
-  EXTENSIONAPI static const core::Property Password;
-  EXTENSIONAPI static const core::Property SecurityProtocol;
-  EXTENSIONAPI static const core::Property SecurityCA;
-  EXTENSIONAPI static const core::Property SecurityCert;
-  EXTENSIONAPI static const core::Property SecurityPrivateKey;
-  EXTENSIONAPI static const core::Property SecurityPrivateKeyPassword;
-
-
-  static auto basicProperties() {
-    return std::array{
+  EXTENSIONAPI static constexpr auto BrokerURI = core::PropertyDefinitionBuilder<>::createProperty("Broker URI")
+      .withDescription("The URI to use to connect to the MQTT broker")
+      .isRequired(true)
+      .build();
+  EXTENSIONAPI static constexpr auto ClientID =       core::PropertyDefinitionBuilder<>::createProperty("Client ID")

Review Comment:
   Extra spaces



##########
PROCESSORS.md:
##########
@@ -469,12 +471,12 @@ In the list below, the names of required properties appear in bold. Any other pr
 | Resolve Metadata in Attributes     | true                                                                                                                                                                                                                        |                                     | If true, any metadata that is resolved ( such as IDs or keyword metadata ) will be placed into attributes, otherwise it will be replaced in the XML or text output                                                                                                                                                                                                    |
 | Event Header Delimiter             |                                                                                                                                                                                                                             |                                     | If set, the chosen delimiter will be used in the Event output header. Otherwise, a colon followed by spaces will be used.                                                                                                                                                                                                                                             |
 | Event Header                       | LOG_NAME=Log Name, SOURCE = Source, TIME_CREATED = Date,EVENT_RECORDID=Record ID,EVENTID = Event ID,TASK_CATEGORY = Task Category,LEVEL = Level,KEYWORDS = Keywords,USER = User,COMPUTER = Computer, EVENT_TYPE = EventType |                                     | Comma seperated list of key/value pairs with the following keys LOG_NAME, SOURCE, TIME_CREATED,EVENT_RECORDID,EVENTID,TASK_CATEGORY,LEVEL,KEYWORDS,USER,COMPUTER, and EVENT_TYPE. Eliminating fields will remove them from the header.                                                                                                                                |
-| **Output Format**                  | Both                                                                                                                                                                                                                        | Both<br/>JSON<br/>Plaintext<br/>XML | Set the output format type. In case 'Both' is selected the processor generates two flow files for every event captured in format XML and Plaintext                                                                                                                                                                                                                    |
-| **JSON Format**                    | Simple                                                                                                                                                                                                                      | Simple<br/>Raw<br/>Flattened        | Set the json format type. Only applicable if Output Format is set to 'JSON'                                                                                                                                                                                                                                                                                           |
+| **Output Format**                  | Both                                                                                                                                                                                                                        | XML<br/>Both<br/>Plaintext<br/>JSON | Set the output format type. In case 'Both' is selected the processor generates two flow files for every event captured in format XML and Plaintext                                                                                                                                                                                                                    |
+| **JSON Format**                    | Simple                                                                                                                                                                                                                      | Raw<br/>Simple<br/>Flattened        | Set the json format type. Only applicable if Output Format is set to 'JSON'                                                                                                                                                                                                                                                                                           |
 | Batch Commit Size                  | 1000                                                                                                                                                                                                                        |                                     | Maximum number of Events to consume and create to Flow Files from before committing.                                                                                                                                                                                                                                                                                  |
 | State Directory                    | CWELState                                                                                                                                                                                                                   |                                     | DEPRECATED. Only use it for state migration from the state file, supplying the legacy state directory.                                                                                                                                                                                                                                                                |
 | **Process Old Events**             | false                                                                                                                                                                                                                       |                                     | This property defines if old events (which are created before first time server is started) should be processed.                                                                                                                                                                                                                                                      |
-| Cache SID Lookups                  | true                                                                                                                                                                                                                        | true<br>false                       | Determines whether SID to name lookups are cached in memory                                                                                                                                                                                                                                                                                                           |
+| Cache SID Lookups                  | true                                                                                                                                                                                                                        |                                     | Determines whether SID to name lookups are cached in memory                                                                                                                                                                                                                                                                                                           |

Review Comment:
   true/false was more helpful than nothing



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org