bakaid commented on a change in pull request #636: Minificpp-780 - Change
GenerateFlowFile to allow 0b content FlowFiles
URL: https://github.com/apache/nifi-minifi-cpp/pull/636#discussion_r343707517
##########
File path: extensions/standard-processors/processors/GenerateFlowFile.cpp
##########
@@ -77,88 +73,67 @@ void GenerateFlowFile::initialize() {
setSupportedRelationships(relationships);
}
-void GenerateFlowFile::onTrigger(core::ProcessContext *context,
core::ProcessSession *session) {
- uint64_t batchSize = 1;
- bool uniqueFlowFile = true;
- uint64_t fileSize = 1024;
- bool textData = false;
+void generateData(std::vector<char>& data, bool textData = false) { // NOLINT
+ std::random_device rd;
+ std::mt19937 eng(rd());
+ if (textData) {
+ std::uniform_int_distribution<> distr(0, TEXT_LEN);
Review comment:
I know this is legacy, but it took me a while to figure out why this is
right. The `TEXT_CHARS` array contains 91 elements, so `TEXT_LEN` in reality is
not the length of the array, but the maximum index. I think the previous
version, which used % TEXT_LEN was erroneus, and now that we generate indexes
from [0, TEXT_LEN] we are good, but it is not easy to understand.
I'm OK with merging this, but it should be replaced with something more
straightforward eventually.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services