szaszm commented on code in PR #1843:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1843#discussion_r1688034868
##########
extensions/lua/LuaProcessSession.cpp:
##########
@@ -43,78 +39,58 @@ std::shared_ptr<LuaScriptFlowFile> LuaProcessSession::get()
{
return result;
}
-void LuaProcessSession::transfer(const std::shared_ptr<LuaScriptFlowFile>
&script_flow_file,
+void LuaProcessSession::transfer(const std::shared_ptr<LuaScriptFlowFile>&
script_flow_file,
const core::Relationship& relationship) {
- if (!session_) {
- throw std::runtime_error("Access of ProcessSession after it has been
released");
- }
-
- auto flow_file = script_flow_file->getFlowFile();
+ const auto flow_file = script_flow_file->getFlowFile();
if (!flow_file) {
throw std::runtime_error("Access of FlowFile after it has been released");
}
- session_->transfer(flow_file, relationship);
+ session_.transfer(flow_file, relationship);
}
void LuaProcessSession::read(const std::shared_ptr<LuaScriptFlowFile>
&script_flow_file,
sol::table input_stream_callback) {
- if (!session_) {
- throw std::runtime_error("Access of ProcessSession after it has been
released");
- }
-
- auto flow_file = script_flow_file->getFlowFile();
+ const auto flow_file = script_flow_file->getFlowFile();
if (!flow_file) {
throw std::runtime_error("Access of FlowFile after it has been released");
}
- session_->read(flow_file, [&input_stream_callback](const
std::shared_ptr<io::InputStream>& input_stream) -> int64_t {
+ session_.read(flow_file, [&input_stream_callback](const
std::shared_ptr<io::InputStream>& input_stream) -> int64_t {
sol::function callback = input_stream_callback["process"];
return callback(input_stream_callback,
std::make_shared<LuaInputStream>(input_stream));
});
}
void LuaProcessSession::write(const std::shared_ptr<LuaScriptFlowFile>
&script_flow_file,
sol::table output_stream_callback) {
- if (!session_) {
- throw std::runtime_error("Access of ProcessSession after it has been
released");
- }
-
auto flow_file = script_flow_file->getFlowFile();
if (!flow_file) {
throw std::runtime_error("Access of FlowFile after it has been released");
}
- session_->write(flow_file, [&output_stream_callback](const
std::shared_ptr<io::OutputStream>& output_stream) -> int64_t {
+ session_.write(flow_file, [&output_stream_callback](const
std::shared_ptr<io::OutputStream>& output_stream) -> int64_t {
sol::function callback = output_stream_callback["process"];
return callback(output_stream_callback,
std::make_shared<LuaOutputStream>(output_stream));
});
}
std::shared_ptr<LuaScriptFlowFile> LuaProcessSession::create() {
- if (!session_) {
- throw std::runtime_error("Access of ProcessSession after it has been
released");
- }
-
- auto result = std::make_shared<LuaScriptFlowFile>(session_->create());
+auto result = std::make_shared<LuaScriptFlowFile>(session_.create());
Review Comment:
indentation problem
##########
extensions/python/types/PyProcessSession.h:
##########
@@ -27,7 +27,7 @@ namespace org::apache::nifi::minifi::extensions::python {
class PyProcessSession {
public:
- explicit PyProcessSession(std::shared_ptr<core::ProcessSession> session);
+ explicit PyProcessSession(gsl::not_null<core::ProcessSession*> session);
Review Comment:
The parameter should be a reference instead. The member should remain a
not_null pointer.
--
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]