-
Notifications
You must be signed in to change notification settings - Fork 18
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
Acl improvements #249
Merged
GeorgyKirichenko
merged 17 commits into
yanet-platform:main
from
ol-imorozko:acl-improvements
Sep 24, 2024
Merged
Acl improvements #249
GeorgyKirichenko
merged 17 commits into
yanet-platform:main
from
ol-imorozko:acl-improvements
Sep 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ol-imorozko
force-pushed
the
acl-improvements
branch
3 times, most recently
from
September 19, 2024 14:52
d74f903
to
785132b
Compare
Simplifyes handling of different data types in acl::rule_t actions. This way we can see possible variants more cleanly
Simplified the static_assert to exclude int64_t directly
Replaced multiple if-else cases with a std::visit and generic lambda in the ACL rule processing logic. Makes future modifications easier and ensures that we processed all possible variant types
This is completly redundant: [class.mfct]: "A member function may be defined (9.5) in its class definition, in which case it is an inline (9.2.7) member function if it is attached to the global module"
This is redundant, we have a MAX_COUNT fields with the description
Add a little description to an acl_value functions. Also extract functionality from a compile method into different methods for clarity
Increases readability and maintainability.
Otherwise the name is a little too long
The previous use of true and false as template arguments did not immediately convey their meaning without referencing the Actions definition. So replacing true/false with ActionsPath::WithCheckState and ActionsPath::Default will improve readability
The changes are: - Publically inherit BaseActions<WithCheckState> from BaseActions<Default> The check-state version should have all the functionality of the default path. Inheriting minimizes code duplication by directly reusing path manipulation methods. We avoid using overriding, as the only methods that differ between the two classes (push and pop) are never called from the base class pointers. Since we're not aiming to use polymorphism there's no need to introduce a vtable and the associated runtime overhead. - Add helper methods for retrieving the size of paths and accessing the last actions from both the check-state and default paths (helps with tests)
…aliases Some types are used a lot like common::globalBase::tFlow, so we can save some time by adding an alias
Centralize setup and action visitation logic, reducing duplicated code in unittests
Introduce custom GTest matchers to check for specific variants in `RawAction`. Replace EXPECT_THAT with ::testing::Eq mather with `EXPECT_EQ`. Overall, these changes reduces verbosity and make the code easier to follow.
Moved path validation logic into `compile_acl` to reduce code duplication. Also using newly added methods to `BaseActions` for cleaner access to default and check-state paths.
ol-imorozko
force-pushed
the
acl-improvements
branch
from
September 20, 2024 13:44
785132b
to
fe3c1e0
Compare
Replaced multiple constructors of `rule_t` with a single templated constructor to handle all variants of `rule_action`. This reduces code duplication. Constructor for `skipto` remains unchanged.
GeorgyKirichenko
approved these changes
Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some improvements for ACL code.
Mainly reducing boilerplate code for acl unittests