martinzink commented on a change in pull request #1188:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1188#discussion_r724133054



##########
File path: extensions/standard-processors/processors/DefragTextFlowFiles.h
##########
@@ -0,0 +1,121 @@
+/**
+ * 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 <regex>
+#include <memory>
+#include <string>
+#include <set>
+
+#include "core/Processor.h"
+#include "utils/FlowFileStore.h"
+#include "utils/Enum.h"
+#include "serialization/PayloadSerializer.h"
+
+
+namespace org::apache::nifi::minifi::processors {
+
+class DefragTextFlowFiles : public core::Processor {
+ public:
+  explicit DefragTextFlowFiles(const std::string& name,  const 
utils::Identifier& uuid = {})
+      : Processor(name, uuid) {
+    logger_ = logging::LoggerFactory<DefragTextFlowFiles>::getLogger();
+  }
+  EXTENSIONAPI static core::Relationship Self;
+  EXTENSIONAPI static core::Relationship Success;
+  EXTENSIONAPI static core::Relationship Original;
+  EXTENSIONAPI static core::Relationship Failure;
+
+  EXTENSIONAPI static core::Property Pattern;
+  EXTENSIONAPI static core::Property PatternLoc;
+  EXTENSIONAPI static core::Property MaxBufferAge;
+  EXTENSIONAPI static core::Property MaxBufferSize;

Review comment:
       good point, made them const in 
https://github.com/apache/nifi-minifi-cpp/pull/1188/commits/5d72e19a90d8c596b301ca47d2fb8459848d806d

##########
File path: libminifi/include/utils/FlowFileStore.h
##########
@@ -0,0 +1,51 @@
+/**
+ * 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 <memory>
+#include <unordered_set>
+#include <utility>
+
+#include "core/FlowFile.h"
+namespace org::apache::nifi::minifi::utils {
+
+class FlowFileStore {
+ public:
+  std::unordered_set<std::shared_ptr<core::FlowFile>> getNewFlowFiles() {
+    bool hasNewFlowFiles = true;
+    if (!has_new_flow_file_.compare_exchange_strong(hasNewFlowFiles, false, 
std::memory_order_acquire, std::memory_order_relaxed)) {
+      return {};
+    }
+    std::lock_guard<std::mutex> guard(flow_file_mutex_);
+    return std::move(incoming_files_);
+  }
+
+  void put(const std::shared_ptr<core::FlowFile>& flowFile)  {
+    {
+      std::lock_guard<std::mutex> guard(flow_file_mutex_);
+      incoming_files_.emplace(std::move(flowFile));

Review comment:
       I addressed this in 
https://github.com/apache/nifi-minifi-cpp/pull/1188/commits/8c801f80f17dc35684c2def5f4b13aaf1b264f2f

##########
File path: libminifi/include/utils/FlowFileStore.h
##########
@@ -0,0 +1,51 @@
+/**
+ * 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 <memory>
+#include <unordered_set>
+#include <utility>
+
+#include "core/FlowFile.h"
+namespace org::apache::nifi::minifi::utils {
+
+class FlowFileStore {

Review comment:
       good idea changed it in 
https://github.com/apache/nifi-minifi-cpp/pull/1188/commits/8c801f80f17dc35684c2def5f4b13aaf1b264f2f




-- 
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