You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/04/25 11:29:01 UTC
[GitHub] [nifi-minifi-cpp] lordgamez opened a new pull request, #1316: MINIFICPP-1687 Signal error on UUID collision
lordgamez opened a new pull request, #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316
https://issues.apache.org/jira/browse/MINIFICPP-1687
-------------------------------------------------
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [ ] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file?
- [ ] If applicable, have you updated the NOTICE file?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
lordgamez commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r859602325
##########
libminifi/include/core/yaml/YamlConfiguration.h:
##########
@@ -277,6 +278,7 @@ class YamlConfiguration : public FlowConfiguration {
* @return the parsed or generated UUID string
*/
std::string getOrGenerateId(const YAML::Node& yamlNode, const std::string& idField = "id");
+ std::string getRequiredIdField(const YAML::Node& yaml_node, std::string_view yaml_section = "", std::string error_message = "");
Review Comment:
Good point, it parameter list was copied from `checkRequiredField` and should have been changed. Fixed in 33c6c28c702f72e67add5c9dfd318020019a1788
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
lordgamez commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r859602656
##########
libminifi/src/core/yaml/YamlConfiguration.cpp:
##########
@@ -908,6 +914,14 @@ YAML::Node YamlConfiguration::getOptionalField(const YAML::Node& yamlNode, const
return result;
}
+void YamlConfiguration::addNewId(const std::string& uuid) {
+ if (uuids_.find(uuid) != uuids_.end()) {
+ throw Exception(ExceptionType::GENERAL_EXCEPTION, "UUID " + uuid + " is duplicated in the flow configuration");
+ }
+
+ uuids_.insert(uuid);
Review Comment:
Good idea, updated in 33c6c28c702f72e67add5c9dfd318020019a1788
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
lordgamez commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r861558365
##########
libminifi/include/core/yaml/YamlConfiguration.h:
##########
@@ -277,6 +278,7 @@ class YamlConfiguration : public FlowConfiguration {
* @return the parsed or generated UUID string
*/
std::string getOrGenerateId(const YAML::Node& yamlNode, const std::string& idField = "id");
+ std::string getRequiredIdField(const YAML::Node& yaml_node, std::string_view yaml_section = "", std::string error_message = "");
Review Comment:
Replaced the error_message string to `std::string_view` int required field checks in 3bdcc32d44536916be6102c6e2b17dc67c7975bd
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a diff in pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
fgerlits commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r859555580
##########
libminifi/include/core/yaml/YamlConfiguration.h:
##########
@@ -277,6 +278,7 @@ class YamlConfiguration : public FlowConfiguration {
* @return the parsed or generated UUID string
*/
std::string getOrGenerateId(const YAML::Node& yamlNode, const std::string& idField = "id");
+ std::string getRequiredIdField(const YAML::Node& yaml_node, std::string_view yaml_section = "", std::string error_message = "");
Review Comment:
could the type of `error_message` be `const std::string&`, to avoid copying?
##########
libminifi/src/core/yaml/YamlConfiguration.cpp:
##########
@@ -908,6 +914,14 @@ YAML::Node YamlConfiguration::getOptionalField(const YAML::Node& yamlNode, const
return result;
}
+void YamlConfiguration::addNewId(const std::string& uuid) {
+ if (uuids_.find(uuid) != uuids_.end()) {
+ throw Exception(ExceptionType::GENERAL_EXCEPTION, "UUID " + uuid + " is duplicated in the flow configuration");
+ }
+
+ uuids_.insert(uuid);
Review Comment:
minor, but `insert()` returns whether the insertion was successful, so we could avoid doing two lookups:
```suggestion
const auto [_, success] = uuids_.insert(uuid);
if (!success) {
throw Exception(ExceptionType::GENERAL_EXCEPTION, "UUID " + uuid + " is duplicated in the flow configuration");
}
```
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
szaszm commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r860800588
##########
libminifi/include/core/yaml/YamlConfiguration.h:
##########
@@ -277,6 +278,7 @@ class YamlConfiguration : public FlowConfiguration {
* @return the parsed or generated UUID string
*/
std::string getOrGenerateId(const YAML::Node& yamlNode, const std::string& idField = "id");
+ std::string getRequiredIdField(const YAML::Node& yaml_node, std::string_view yaml_section = "", std::string error_message = "");
Review Comment:
I would prefer `std::string_view` instead. It avoids copying and doesn't force the caller to allocate a `std::string`.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm closed pull request #1316: MINIFICPP-1687 Signal error on UUID collision
Posted by GitBox <gi...@apache.org>.
szaszm closed pull request #1316: MINIFICPP-1687 Signal error on UUID collision
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org