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


##########
extensions/standard-processors/processors/TailFile.cpp:
##########
@@ -724,24 +723,24 @@ void TailFile::processSingleFile(core::ProcessSession& 
session,
 void TailFile::updateFlowFileAttributes(const std::filesystem::path& 
full_file_name, const TailState& state,
                                         const std::filesystem::path& fileName, 
const std::string& baseName,
                                         const std::string& extension,
-                                        std::shared_ptr<core::FlowFile> 
&flow_file) const {
-  logger_->log_info("TailFile {} for {} bytes", fileName, 
flow_file->getSize());
-  std::string logName = textfragmentutils::createFileName(baseName, extension, 
state.position_, flow_file->getSize());
-  flow_file->setAttribute(core::SpecialFlowAttribute::PATH, 
state.path_.string());
-  flow_file->addAttribute(core::SpecialFlowAttribute::ABSOLUTE_PATH, 
full_file_name.string());
-  flow_file->setAttribute(core::SpecialFlowAttribute::FILENAME, logName);
+                                        core::FlowFile& flow_file) const {

Review Comment:
   @james94 passing everything by shared_ptr is a half decade old legacy of the 
codebase that we're trying to reduce. In most cases, we can assign each object 
to a clear owner, with unique_ptr, which makes it easier to reason about 
lifetimes, and ensures that we don't accidentally create shared_ptr ownership 
cycles like [MINIFICPP-839](https://issues.apache.org/jira/browse/MINIFICPP-839)
   
   And when something doesn't need ownership, it shouldn't get ownership. :)



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