Skip to content
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

Renaming questionable #336

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

jean-roland
Copy link
Contributor

@jean-roland jean-roland commented Jan 30, 2024

In zenoh-pico, for zenoh entities like Queryable or Subscriber, we need to distinguish between the object given to the user and the object we store in the zenoh session.

For Subscriber we have _z_subscriber and _z_subscription which is fine but for Queryable we had _z_queryable and _z_questionable which isn't great as the link between the two isn't clear.

As the problem may arise again for the yet-to-be-implemented Interest entity, _z_questionable should be renamed to _z_session_queryable to more accurately represent the link between those objects and this scheme is applicable to future entities.

As such this PR renames:

  • _z_questionable -> _z_session_queryable
  • questionable_handler -> queryable_handler (the callback type)
  • local_questionables -> local_queryable (the session's list of entity)

}

return ret;
}

_z_questionable_rc_list_t *__z_get_questionable_by_key(_z_questionable_rc_list_t *qles, const _z_keyexpr_t key) {
_z_questionable_rc_list_t *ret = NULL;
_z_session_queryable_rc_list_t *__z_get_session_queryable_by_key(_z_session_queryable_rc_list_t *qles,

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@@ -27,45 +27,48 @@
#include "zenoh-pico/utils/logging.h"

#if Z_FEATURE_QUERYABLE == 1
_Bool _z_questionable_eq(const _z_questionable_t *one, const _z_questionable_t *two) { return one->_id == two->_id; }
_Bool _z_session_queryable_eq(const _z_session_queryable_t *one, const _z_session_queryable_t *two) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file

void _z_questionable_clear(_z_questionable_t *qle) {
void _z_session_queryable_clear(_z_session_queryable_t *qle) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
_z_questionable_rc_list_t *__unsafe_z_get_questionable_by_key(_z_session_t *zn, const _z_keyexpr_t key) {
_z_questionable_rc_list_t *qles = zn->_local_questionable;
return __z_get_questionable_by_key(qles, key);
_z_session_queryable_rc_list_t *__unsafe_z_get_session_queryable_by_key(_z_session_t *zn, const _z_keyexpr_t key) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@@ -105,13 +108,13 @@
return qle;
}

_z_questionable_rc_list_t *_z_get_questionable_by_key(_z_session_t *zn, const _z_keyexpr_t *keyexpr) {
_z_session_queryable_rc_list_t *_z_get_session_queryable_by_key(_z_session_t *zn, const _z_keyexpr_t *keyexpr) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file

#if Z_FEATURE_MULTI_THREAD == 1
zp_mutex_unlock(&zn->_mutex_inner);
#endif // Z_FEATURE_MULTI_THREAD == 1
}

void _z_flush_questionables(_z_session_t *zn) {
void _z_flush_session_queryable(_z_session_t *zn) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@@ -120,18 +123,18 @@
return qles;
}

_z_questionable_rc_t *_z_register_questionable(_z_session_t *zn, _z_questionable_t *q) {
_z_session_queryable_rc_t *_z_register_session_queryable(_z_session_t *zn, _z_session_queryable_t *q) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@@ -181,24 +184,25 @@
return ret;
}

void _z_unregister_questionable(_z_session_t *zn, _z_questionable_rc_t *qle) {
void _z_unregister_session_queryable(_z_session_t *zn, _z_session_queryable_rc_t *qle) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
if (qle->_dropper != NULL) {
qle->_dropper(qle->_arg);
}
_z_keyexpr_clear(&qle->_key);
}

/*------------------ Queryable ------------------*/
_z_questionable_rc_t *__z_get_questionable_by_id(_z_questionable_rc_list_t *qles, const _z_zint_t id) {
_z_questionable_rc_t *ret = NULL;
_z_session_queryable_rc_t *__z_get_session_queryable_by_id(_z_session_queryable_rc_list_t *qles, const _z_zint_t id) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@@ -453,7 +453,7 @@
return (z_owned_closure_sample_t){.call = call, .drop = drop, .context = context};
}

z_owned_closure_query_t z_closure_query(_z_questionable_handler_t call, _z_dropper_handler_t drop, void *context) {
z_owned_closure_query_t z_closure_query(_z_queryable_handler_t call, _z_dropper_handler_t drop, void *context) {

Check warning

Code scanning / Cppcheck (reported by Codacy)

misra violation 804 with no text in the supplied rule-texts-file Warning

misra violation 804 with no text in the supplied rule-texts-file
@Mallets Mallets merged commit 19e7757 into eclipse-zenoh:main Jan 30, 2024
48 checks passed
@p-avital
Copy link
Contributor

RIP questionables :(

@jean-roland jean-roland deleted the rfct_rename_questionable branch February 16, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants