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


##########
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:
   No particular problems but this makes the signature more clear and removes 
unnecessary restrictions, so this could help future refactors.
   
   -   this function could easily work on flowfiles owned by unique_ptrs or 
flowfiles on the stack
   -   it also ensures that the flowfile is not supposed to be a nullptr and 
moves the responsibility to ensure it is not null to the caller side (when it 
deferences the shared_ptr for example)



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