-
Notifications
You must be signed in to change notification settings - Fork 0
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
to support a feature of content filtered topic #1
base: master
Are you sure you want to change the base?
Conversation
01ed156
to
8ef3b0d
Compare
Signed-off-by: Chen Lihui <[email protected]>
Signed-off-by: Chen Lihui <[email protected]>
Signed-off-by: Chen Lihui <[email protected]>
rcl/include/rcl/subscription.h
Outdated
* | ||
* \param[in] option The structure which its resources have to be deallocated. | ||
* \return `RCL_RET_OK` if the memory was successfully freed, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if log_levels is NULL, or |
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.
* \return `RCL_RET_INVALID_ARGUMENT` if log_levels is NULL, or | |
* \return `RCL_RET_INVALID_ARGUMENT` if option is NULL, or |
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.
updated
rcl/include/rcl/subscription.h
Outdated
* Lock-Free | Maybe [1] | ||
* | ||
* \param[in] subscription the subscription object to inspect. | ||
* \param[in] filter_expression An filter expression to set. |
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.
* \param[in] filter_expression An filter expression to set. | |
* \param[in] filter_expression A filter expression to set. |
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.
updated
* it can be NULL if there is no placeholder in filter_expression. | ||
* \return `RCL_RET_OK` if the query was successful, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if `subscription` is NULL, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if `filter_expression` is NULL, or |
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.
How we can reset
the filtering on subscription? i think that there should be a way to do that, since the application is likely to do the following.
- create subscription.
- receive messages via subscription.
- set content filtering.
- receive messages via cft subscription.
- reset content filtering.
- receive messages via subsciption.
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 was thinking as following,
- If a subscription can be filtered, users should set this subscription with filter_expression(""), not NULL.
- receive all messages
- update filter_expression with custom value by
rcl_subscription_set_cft_expression_parameters
, such as "data MATCH 'Hello World: 5'" - receive messages via cft subscription
- set filter_expression("") to reset.
- receive all messages
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.
okay, i see and it works
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.
okay, i see and it works
I am sorry. After checking and trying to reproduce the above case, I found it's not supported.
Currently,
User must set content filter topic with a non-empty string for subscription at the beginning, and then update with a new filter (not empty string).
it means if users create a subscription without a content filter expression, this subscription can't subscribe to the content filter topic anymore.
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.
don't be 😄 we just trying some new stuff, there will be something like this.
okay that is said, the followings should be done in user application aspect?
- user creates normal subscription.
- if user wants to use contentfilter, application provides the filtering expression and parameters which are not NULL. (actually this is the 1st time to create contentfilteredtopic based on the parent topic)
- user can only have events from contentfilteredtopic but not from parent topic.
- user can change and modify the filtering expression and parameters which are not NULL.
- if the user wants to use normal topic (in other words, parent topic) user can specify NULL filtering expression and parameters? rmw takes NULL expression and then in the backend it will delete the contentfilteredtopic?
i am not sure if anything like this feasible, but if we do, it just appears to be the filtering expression and parameters interfaces only for user application. in other words, it can conceal creating/destroying contentfilteredtopic to user application, but rmw should take care of.
rcl/include/rcl/subscription.h
Outdated
* \return `RCL_RET_OK` if the query was successful, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if `subscription` is NULL, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if `filter_expression` is NULL, or | ||
* \return `RCL_RET_INCORRECT_RMW_IMPLEMENTATION` if the `node` implementation |
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.
RCL_RET_INCORRECT_RMW_IMPLEMENTATION
is going to be defined in rcl
later? i do not see this is already supported in rcl
. and actually never used.
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'll remove it
rcl/src/rcl/subscription.c
Outdated
subscription->impl->options = *options; | ||
ret = rcl_subscription_options_copy(options, &subscription->impl->options); | ||
if (RCL_RET_OK != ret) { | ||
ret = RCL_RET_ERROR; |
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 we need to overwrite the error code here?
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.
updated
@@ -116,8 +119,12 @@ rcl_subscription_init( | |||
} | |||
subscription->impl->actual_qos.avoid_ros_namespace_conventions = | |||
options->qos.avoid_ros_namespace_conventions; | |||
// options | |||
subscription->impl->options = *options; | |||
ret = rcl_subscription_options_copy(options, &subscription->impl->options); |
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 at this time, calling rnw_create_subscription
is to create parent
subscription for content filtering. so actually it just saves filter_expression
and expression_parameters
, not to be used during creating subscription. am i understanding right? and beside, at this moment, it is likely that filter_expression
and expression_parameters
are empty, right? because rcl_subscription_set_cft_expression_parameters
cannot be called before.
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 at this time, calling
rnw_create_subscription
is to createparent
subscription for content filtering. so actually it just savesfilter_expression
andexpression_parameters
, not to be used during creating subscription. am i understanding right?
The concrete rmw(rmw_connextdds) had already directly used filter_expression
and expression_parameters
rcl/rcl/src/rcl/subscription.c
Line 101 in 6ef26c8
subscription->impl->rmw_handle = rmw_create_subscription( |
I thought that these two parameters should be backed up into
rcl_subscription_impl_t
, so it can prevent from accessing a pointer that might be changed outside.
and beside, at this moment, it is likely that
filter_expression
andexpression_parameters
are empty, right? becausercl_subscription_set_cft_expression_parameters
cannot be called before.
Yes.
rcl/src/rcl/subscription.c
Outdated
} | ||
} | ||
|
||
if (src->rmw_subscription_options.expression_parameters) { |
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.
probably return error if filter_expression
is not null but expression_parameters
is null. i believe this case cannot exist.
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'll move it inside the above if
statement.
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.
Thank you for your review, I'll update it
@@ -116,8 +119,12 @@ rcl_subscription_init( | |||
} | |||
subscription->impl->actual_qos.avoid_ros_namespace_conventions = | |||
options->qos.avoid_ros_namespace_conventions; | |||
// options | |||
subscription->impl->options = *options; | |||
ret = rcl_subscription_options_copy(options, &subscription->impl->options); |
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 at this time, calling
rnw_create_subscription
is to createparent
subscription for content filtering. so actually it just savesfilter_expression
andexpression_parameters
, not to be used during creating subscription. am i understanding right?
The concrete rmw(rmw_connextdds) had already directly used filter_expression
and expression_parameters
rcl/rcl/src/rcl/subscription.c
Line 101 in 6ef26c8
subscription->impl->rmw_handle = rmw_create_subscription( |
I thought that these two parameters should be backed up into
rcl_subscription_impl_t
, so it can prevent from accessing a pointer that might be changed outside.
and beside, at this moment, it is likely that
filter_expression
andexpression_parameters
are empty, right? becausercl_subscription_set_cft_expression_parameters
cannot be called before.
Yes.
rcl/src/rcl/subscription.c
Outdated
} | ||
} | ||
|
||
if (src->rmw_subscription_options.expression_parameters) { |
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'll move it inside the above if
statement.
rcl/include/rcl/subscription.h
Outdated
* | ||
* \param[in] option The structure which its resources have to be deallocated. | ||
* \return `RCL_RET_OK` if the memory was successfully freed, or | ||
* \return `RCL_RET_INVALID_ARGUMENT` if log_levels is NULL, or |
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.
updated
rcl/include/rcl/subscription.h
Outdated
* Lock-Free | Maybe [1] | ||
* | ||
* \param[in] subscription the subscription object to inspect. | ||
* \param[in] filter_expression An filter expression to set. |
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.
updated
Signed-off-by: Chen Lihui <[email protected]>
temporary PR in my repository