[Solved] Replying to queries on disjoint keys #55
Replies: 5 comments 23 replies
-
For context, the current behaviour is that a queryable may reply with any KE to any query. The query's KE thus selects the queryables that get a chance to reply, but doesn't restrict their set of possible replies in any way. We currently have software in the zenoh ecosystem that relies on this "feature", and know of use-cases that could benefit from it. However, this goes against the intuition that "I queried for X, I should get data for X", and breaks an assertion that can be made on subscribers that you'll only get data relevant to what you asked for in your KE. Note that this is distributed runtime behaviour: we should be very careful about breaking changes around this behaviour. My personal stance is that we should restrict replies to intersect with the queried KE by default, but provide some form of escape hatch for users that would rather work without this restriction, which can be somewhat strong. |
Beta Was this translation helpful? Give feedback.
-
My 2 cents. For safety and consistency reasons, I believe the default behaviour of a query should be the following:
I feel this is a natural expected behaviour that can be found in other technologies like SQL, This kind of default behaviour provides the guarantee the all If such guarantee is not provided, then user code should explicitly check first that In case of Then, thinking about embedded world, providing default filtering would enable early dropping of unwanted replies. Such behaviour would allow bandwidth savings in the network, especially in the last hop which could operated over a constrained/sensor network. Finally, as mentioned by @p-avital , not filtering replies matching the get |
Beta Was this translation helpful? Give feedback.
-
I echo the rationale already exposed by @p-avital and @Mallets .
Summing up, I would prefer to see it not allowed or, if we allowed it for this release, to make it explicitly that the user MUST not do it. |
Beta Was this translation helpful? Give feedback.
-
As we've discussed there are simple examples that show the need for either expanding our query syntax or allowing the flexibility to respond with a key that matches the queryable expression but does not necessarily matches the query expression. Here is a rather simple example, imagine we want to have a queryable that answers with dragon quotes. The key expression for the queryable could be something like
Now when implementing this queryable the question becomes what should we answer for the query on
Answering with This is a simple example that shows how it is handy at times to be able to return something that does not match the key of the query. The specific problem could be resolved differently if we would allow to get any-n when matching a wildcard, in other terms, we could have a syntax like In this case, instead of using I think that constraining a Queryable to answer with keys that match the query can be overly limiting in some use cases. If we introduce enforcing of some kind I think we'd need three levels:
|
Beta Was this translation helpful? Give feedback.
-
After some additional discussion, the conclusion is:
enum ReplyKeyExpr {
Any,
MatchingQuery,
}
fn accept_replies(self, ReplyKeyExpr) -> Self;
fn accepts_replies(&self) -> ReplyKeyExpr; |
Beta Was this translation helpful? Give feedback.
-
We've recently put up for debate whether queryables should be able to reply on Key Expressions (KE) that are disjoint from the query's KE. This discussion's goal is to act as a way for the members of the team to express their opinions with higher fidelity before a final debate.
Beta Was this translation helpful? Give feedback.
All reactions