szaszm commented on a change in pull request #1137:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1137#discussion_r689570484
##########
File path: libminifi/include/core/FlowFile.h
##########
@@ -310,6 +311,10 @@ struct SpecialFlowAttribute {
static const std::string ALTERNATE_IDENTIFIER;
// Flow identifier
static const std::string FLOW_ID;
+
+ static std::unordered_set<std::string> getSpecialFlowAttributes() {
+ return {PATH, ABSOLUTE_PATH, FILENAME, UUID, priority, MIME_TYPE,
DISCARD_REASON, ALTERNATE_IDENTIFIER, FLOW_ID};
Review comment:
We could use a static array of `const char*` or `std::string_view`,
referring to the static strings from above. I want to avoid the overhead of
hash tables is possible, but preferably the allocations and the need to store a
copy in each processor instance as well.
The static object below is just a flat array of a set of pointers to static
storage and sizes, about 144 bytes in size.
```suggestion
static const auto& getSpecialFlowAttributes() {
static const std::array<std::string_view, 9> list{
PATH, ABSOLUTE_PATH, FILENAME, UUID, priority, MIME_TYPE,
DISCARD_REASON, ALTERNATE_IDENTIFIER, FLOW_ID
};
return list;
```
##########
File path: extensions/standard-processors/processors/AttributesToJSON.h
##########
@@ -0,0 +1,106 @@
+/**
+ * @file AttributesToJSON.h
+ * AttributesToJSON class declaration
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <vector>
+#include <string>
+#include <set>
+#include <unordered_set>
+#include <memory>
+#include <map>
+#include <regex>
+
+#include "rapidjson/document.h"
+#include "core/Processor.h"
+#include "core/Property.h"
+#include "core/logging/Logger.h"
+#include "utils/Enum.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+class AttributesToJSON : public core::Processor {
+ public:
+ // Supported Properties
+ static const core::Property AttributesList;
+ static const core::Property AttributesRegularExpression;
+ static const core::Property Destination;
+ static const core::Property IncludeCoreAttributes;
+ static const core::Property NullValue;
+
+ // Supported Relationships
+ static core::Relationship Success;
Review comment:
This could (and IMHO should) be `const`.
--
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]