-
Notifications
You must be signed in to change notification settings - Fork 640
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
Use PointerVector to manage devices in DeviceLists. #1488
Open
Dimi1010
wants to merge
12
commits into
seladb:dev
Choose a base branch
from
Dimi1010:refactor/device-list-management
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
- Deprecated `getPcapLiveDevicesList` in favor of the iteration API.
tigercosmos
reviewed
Jul 7, 2024
tigercosmos
reviewed
Jul 7, 2024
tigercosmos
reviewed
Jul 9, 2024
tigercosmos
approved these changes
Jul 10, 2024
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
- Added iterator API - Added iterator type aliases. - Deprecated getPfRingDevicesList. - Updated calls to getPfRingDevicesList.
@tigercosmos added |
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.
Rework of #1431 p1 and p2.
Refactored to use
PointerVector<Device>
in lists:PcapLiveDeviceList
- provides a better API thenstd::vector<std::unique_ptr<Device>>
PcapRemoteDeviceList
- provides an automatic memory management thenstd::vector<Device*>
PfRingDeviceList
- provides a better API thenstd::vector<std::unique_ptr<Device>>
Added
begin/end
iteration API to lists:PcapLiveDeviceList
PfRingDeviceList
Added
iterator
andconst_iterator
type aliases to the lists.IMO, the member type definitions should follow the standard member types, even if they slightly deviate from the internal library convention as that would allow better integration with standard templated utility functions and classes.
In addition, I feel like the names
PcapRemoteDeviceIterator
andPcapConstRemoteDeviceIterator
should be best left to concrete definitions of custom iterator classes if needed, instead of being member type alias definitions. Part of the point of the member type alias definitions is to allow templated functions to dynamically fetch the type of the container at compile time, and for that the definition member identifier needs to be consistent across different containers.Affected lists:
PcapLiveDeviceList
PcapRemoteDeviceList
PfRingDeviceList
Deprecated
getPcap*DevicesList
.The list classes should provide direct functions for iteration and fetching devices. It makes no sense to have to get another 'List' from a 'List' class. Additionally this getter in particular returns a reference which ties the internal implementation to it making it difficult to change.
Affected Lists:
PcapLiveDeviceList
PfRingDeviceList
Updated usages of deprecated methods in the library with non-deprecated methods.