-
Notifications
You must be signed in to change notification settings - Fork 404
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
Iox #415 remove InvalidIdString and isValid() from ServiceDescription #1047
Iox #415 remove InvalidIdString and isValid() from ServiceDescription #1047
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1047 +/- ##
==========================================
- Coverage 77.55% 77.54% -0.01%
==========================================
Files 340 340
Lines 12827 12815 -12
Branches 1847 1838 -9
==========================================
- Hits 9948 9938 -10
- Misses 2260 2263 +3
+ Partials 619 614 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
iceoryx_posh/include/iceoryx_posh/internal/roudi/port_manager.hpp
Outdated
Show resolved
Hide resolved
iceoryx_posh/include/iceoryx_posh/runtime/service_discovery.hpp
Outdated
Show resolved
Hide resolved
/// @param[in] searchResult, reference to the vector which will be filled with the results | ||
/// @param[in] service, string or wildcard to search for | ||
/// @param[in] instance, string or wildcard to search for | ||
void find(ServiceDescriptionVector_t& searchResult, | ||
const capro::IdString_t& service = Wildcard, | ||
const capro::IdString_t& instance = Wildcard) const noexcept; | ||
const cxx::variant<cxx::Wildcard_t, capro::IdString_t>& service, |
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.
You could think about keeping the default argument Wildcard
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.
Not sure this is possible with variant
without wrapping it, i.e. constructing a variant
with Wildcard
. In any case I prefer overloads in theory, i.e. have a call with service, one with instance, one with both and one without arguments. This improves dispatching as well and internally the cases are implemented in a switch statement otherwise anyway.
The reasoning is to prefer early dispatching mechanisms if possible.
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.
@mossmaurice I decided against because it was not used anywhere, not even tested, and as @MatthiasKillat wrote, it's not that easy with a variant.
@@ -41,8 +42,8 @@ class ServiceDiscovery | |||
/// ServiceContainer: on success, container that is filled with all matching instances | |||
/// FindServiceError: if any, encountered during the operation | |||
cxx::expected<ServiceContainer, FindServiceError> | |||
findService(const cxx::variant<Wildcard_t, capro::IdString_t> service, | |||
const cxx::variant<Wildcard_t, capro::IdString_t> instance) noexcept; | |||
findService(const cxx::variant<cxx::Wildcard_t, capro::IdString_t>& service, |
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.
Because that's part of the user API it should be IMHO in runtime
.
findService(const cxx::variant<cxx::Wildcard_t, capro::IdString_t>& service, | |
findService(const cxx::variant<runtime::Wildcard_t, capro::IdString_t>& service, |
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 the Wildcard belongs to the same namespace as the ServiceDescription
but we may change some of those later, so I am not sure yet and until we know it is not important.
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 agree with @MatthiasKillat and moved the Wildcard (now a nullopt) to the ServiceDescription
, so the namespace is now capro
.
// send find to all interfaces | ||
capro::CaproMessage caproMessage(capro::CaproMessageType::FIND, {service, instance, roudi::Wildcard}); | ||
|
||
for (auto interfacePortData : m_portPool->getInterfacePortDataList()) | ||
{ | ||
iox::popo::InterfacePort interfacePort(interfacePortData); | ||
interfacePort.dispatchCaProMessage(caproMessage); | ||
} | ||
|
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.
Why was this part removed?
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 also do not understand this, but I suspect it has something to do with the FIND message being changed and interface ports not being used properly (in the sense that they will not answer the request anyway).
But that is just a guess and requires clarification. @FerdinandSpitzschnueffler
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.
After changing the findService
parameters, this code had to be adapted since the CaproMessage
c'tor requires a ServiceDescription
. I discussed several ideas with @elfenpiff, but then we came to the conclusion that the CaproMessage
itself could need some refactoring and that we can send the find
here but there will be no answer anyway as @MatthiasKillat stated.
iceoryx_posh/include/iceoryx_posh/capro/service_description.hpp
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.
Looks OK, minor clarifications needed and I consider the variant
interface problematic in the long-term but this PR is not the place to change that.
{ | ||
/// @todo #415 remove the string mapping, once the find call is done via shared memory | ||
capro::IdString_t serviceString; | ||
capro::IdString_t instanceString; | ||
bool isServiceWildcard = false; | ||
bool isInstanceWildcard = false; | ||
|
||
if (service.index() == 0U) |
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.
We could maybe also introduce a helper function
bool isWildCard(const cxx::variant< ... >& value) {
return value.index() == 0U;
}
This will be inlined and make the code more expressive.
// send find to all interfaces | ||
capro::CaproMessage caproMessage(capro::CaproMessageType::FIND, {service, instance, roudi::Wildcard}); | ||
|
||
for (auto interfacePortData : m_portPool->getInterfacePortDataList()) | ||
{ | ||
iox::popo::InterfacePort interfacePort(interfacePortData); | ||
interfacePort.dispatchCaProMessage(caproMessage); | ||
} | ||
|
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 also do not understand this, but I suspect it has something to do with the FIND message being changed and interface ports not being used properly (in the sense that they will not answer the request anyway).
But that is just a guess and requires clarification. @FerdinandSpitzschnueffler
aae8eae
to
4fe9b1d
Compare
…istry Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
Signed-off-by: Marika Lehmann <marika.lehmann@apex.ai>
2d372eb
4fe9b1d
to
2d372eb
Compare
Pre-Review Checklist for the PR Author
iox-#123-this-is-a-branch
)iox-#123 commit text
)git commit -s
)task-list-completed
)Notes for Reviewer
This PR removes
InvalidIdString
andisValid()
fromServiceDescription
and replaces the Wildcard string with a nullopt. With this, theServiceDescription
can contain any string, empty strings by default.Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References