-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINIFICPP-2465 SplitContent #1872
base: main
Are you sure you want to change the base?
Conversation
ec376f1
to
bcd607b
Compare
bcd607b
to
99c84f1
Compare
extensions/standard-processors/tests/unit/SplitContentTests.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a caveat: I find the logic quite convoluted, but I didn't take the time to design something simpler that I could suggest.
If you have ideas to simplify the logic inside onTrigger and the related member functions, I think that would be a good target for refactoring.
Co-authored-by: Adam Debreceni <[email protected]>
class ByteSequenceMatcher { | ||
public: | ||
explicit ByteSequenceMatcher(std::vector<std::byte> byte_sequence); | ||
size_type getNumberOfMatchingBytes(size_type number_of_currently_matching_bytes, std::byte next_byte); | ||
size_type getPreviousMaxMatch(size_type number_of_currently_matching_bytes); | ||
[[nodiscard]] std::span<const std::byte> getByteSequence() const { return byte_sequence_; } | ||
|
||
private: | ||
struct node { | ||
std::byte byte; | ||
std::unordered_map<std::byte, size_type> cache; | ||
std::optional<size_type> previous_max_match; | ||
}; | ||
std::vector<node> byte_sequence_nodes_; | ||
const std::vector<std::byte> byte_sequence_; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this class could be moved to the .cpp file
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:
For documentation related changes:
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.