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

Add owned_query entity #327

Merged
merged 4 commits into from
Jan 25, 2024
Merged

Conversation

jean-roland
Copy link
Contributor

This new entitiy based on a refcounter allows the query entitiy received in a queryable callback to be extracted from said callback in order to be processed in another context, if needed.

Requested by @p-avital.

Allows z_query to be extracted from queryable callbacks if needed.
src/session/queryable.c Fixed Show fixed Hide fixed
@@ -327,7 +327,7 @@
return _Z_RES_OK;
}

int8_t _z_send_reply(const z_query_t *query, _z_keyexpr_t keyexpr, const _z_value_t payload) {
int8_t _z_send_reply(const _z_query_t *query, _z_keyexpr_t keyexpr, const _z_value_t payload) {

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_query_t;

void _z_query_clear(_z_query_t *q);
_Z_REFCOUNT_DEFINE(_z_query, _z_query)

Check warning

Code scanning / Cppcheck (reported by Codacy)

There is an unknown macro here somewhere. Configuration is required. If _Z_REFCOUNT_DEFINE is a macro then please configure it. Warning

There is an unknown macro here somewhere. Configuration is required. If _Z_REFCOUNT_DEFINE is a macro then please configure it.
@@ -13,6 +13,10 @@

#include "zenoh-pico/net/query.h"

void _z_query_clear(_z_query_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
return parameters;
}

z_value_t z_query_value(const z_query_t *query) { return query->_value; }
z_value_t z_query_value(const z_query_t *query) { return query->_val._rc.in->val._value; }

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_keyexpr_t z_query_keyexpr(const z_query_t *query) { return query->_key; }
z_keyexpr_t z_query_keyexpr(const z_query_t *query) { return query->_val._rc.in->val._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
Copy link
Contributor

@p-avital p-avital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the owned query actually owns anything right now

src/session/queryable.c Outdated Show resolved Hide resolved
src/net/query.c Show resolved Hide resolved
@@ -72,6 +72,11 @@
*value = _z_value_null();
return ret;
}
void _z_value_copy(_z_value_t *dst, const _z_value_t *src) {

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
@@ -140,7 +141,7 @@
return ret;
}

int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *query, const _z_keyexpr_t q_key, uint32_t qid) {
int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *msgq, const _z_keyexpr_t q_key, uint32_t qid) {

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_QUERYABLE == 1
_z_query_t _z_query_create(const _z_value_t *value, const _z_keyexpr_t *key, const _z_bytes_t *parameters,

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
@p-avital p-avital merged commit a87cea8 into eclipse-zenoh:main Jan 25, 2024
48 checks passed
@jean-roland jean-roland deleted the ft_owned_querry 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.

2 participants